Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Grid Layout Flexible Sized Grids Repeat Tracks with auto-fill and auto-fit

auto-fit or auto-fill not working

I am trying to follow code but my code isn't working. Here is my workspace snapshot https://w.trhou.se/ykaxw8mt0t . What am i doing wrong?

1 Answer

David Moorhead
David Moorhead
18,005 Points

Hi, ammarkhan,

Since I'm working in the dark, notice a line of your code has been commented out, and replaced with code I thought might be helpful.

Would some of my code work to your advantage? To me, the result looks like a familiar Treehouse exercise.

/* ===================================== 
   Grid Layout
======================================== */

.grid {
  max-width: 1000px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  grid-template-rows: 100px 50px;
  grid-gap: 20px;
}

/*   grid-template-columns: repeat(auto-fill, 20em);    */