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 - Beyond the Basics Working with Media Queries Adaptive Layouts: Wide Viewports

christophe Bonge
christophe Bonge
6,618 Points

About the .extra div

Hi, in this media querie :

@media only screen and (min-width: 769px) { .logo { float: left; } .main-nav { float: right; } .main { width: 40.425531914894%; } .extra { display: block; width: 23.404255319149%; } }

why do we declare the .extra div as a block assuming this is a div so it's already a block ?

2 Answers

Kevin Korte
Kevin Korte
28,149 Points

Because outside of the media queries, extra is set to display: none. This is the mobile first thought process where media queries should be used to to make adjustments as the screen grows.

When the screen is big enough, and we want to show the extra div, we set it back to display: block which is the default value of a div, but it has to be over ride the display: none set before it.

christophe Bonge
christophe Bonge
6,618 Points

Thanks for the answer; i was afk for a pretty long time and didn't see your answer much earlier.