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 Layout Techniques Display Modes Column Layout with Inline-Block

Mark Lawson
Mark Lawson
6,148 Points

Initial Height

Why does the initial height in the Css media query cause the columns to stack?

Thanks

4 Answers

Erik Nuber
Erik Nuber
20,629 Points

Could you be more specific, height shouldn't affect whether columns stack. Usually it would be because display: block is being used or, the width being set is greater than the room allowed.

Mark Lawson
Mark Lawson
6,148 Points

7:20 into the video he adds the css code "height: initial" into the media query. When he reduces the screen down, the columns stack.

Erik Nuber
Erik Nuber
20,629 Points

I downloaded the files from the course and removed the height: initial. It doesn't actually affect anything. He is simply resetting the defaults. This doesn't actually make sense as the height is never adjusted from the initial height of the column set to 100%. It is never changed. I think it is simply the idea that the best practice is to set the width and height properties.

Mark Lawson
Mark Lawson
6,148 Points

When I made the screen smaller I am sure the columns stayed in line with each other. When he added the height:initial the columns started to stack. I will have to go back and have a look.