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

Louis Young
PLUS
Louis Young
Courses Plus Student 1,269 Points

How to stop CSS Grids inheriting their parents height?

Hi all,

I'm trying out my first mobile-first fluid website layout using CSS3 grids.

It's mostly going fine. However - I can't stop other grids from inheriting the same height as others.

For example, if one grid has a simple paragraph and is 10px tall, and I add a h1 which is 20px tall to another column, both take the height of 20px.

I think this is due to my use of fractional as a unit. But without it, the site isn't fluid/scaleable.

Thanks.

Codepen:

https://codepen.io/LouisRY/pen/ppBBRO

1 Answer

Steven Parker
Steven Parker
231,008 Points

If you're talking about the size of columns on a row, it's the nature of a grid for them to be the same.

But if you're talking about how all the rows change size, then yes, it 's because they all share fixed "fr" units. But the template for rows can use "minmax" to specify a span with possibly "auto" as a value. These will still allow the responsive features but not force the all the row heights to change just because one does.