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

Is the min-max value outdated now? Typing exactly what the instructor is typing and each column never grows beyond 60px.

Is there something wrong with this code? My browser won't let columns grow beyond 60px.

.grid { max-width: 1000px; display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); grid-template-rows: 100px 100px; grid-gap: 15px; }

1 Answer

Hi Andres!

This worked for me:

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

I had to do a lot of testing to figure this out, but what I discovered, and don't quite understand, is this:

It works if you resize the browser, but NOT in the Chrom devtools console device simulators, for some reason!?!

I hope that helps.

Stay safe and happy coding!

Alex Hipolito
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alex Hipolito
Full Stack JavaScript Techdegree Graduate 17,582 Points

Hey Peter, thanks for sharing this answer.

I found that grid resizes in Chrome DevTools mobile web simulators if you add the following to the exercise's index.html <head> tags:

<meta name="viewport" content="width=device-width, initial-scale=1">

This will set the width of the viewport to the device's width and then the initial zoom level when the page is first loaded. More information can be found on MDN - Viewport Basics