Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.