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 trialZoe Campbell
6,288 PointsWhy does clearfix only work on my browser is if put it at the top of the media query and not the bottom?
Why does clearfix only work on my browser is if put it at the top of the media query and not the bottom?
3 Answers
Steven Parker
231,248 PointsThe "cascade" of CSS means that when settings have the same specificity, the ones that come last take precedence. This is why media queries would normally be placed after other code, so when their conditions apply they will override the other settings.
For a more specific analysis of what is happening in your particular example, you would need to show your code (formatted for markdown) here. Better yet, you could make a snapshot of your workspace and post the link to it here.
Zoe Campbell
6,288 PointsThat makes sense, i ask only because the tutor states to add the clearfix to the bottom of the media query on this video. https://w.trhou.se/ei0h5anrao
Steven Parker
231,248 PointsThat link was for your code (snapshot), not the video.
But I tried moving the clearfix to the bottom of the media query, and I did not see any difference in the displayed page. None of the properties set in it conflict with any others in the query, so I would not expect the position to matter.
Did you perhaps place it at the bottom of the file instead of the bottom of the media query the first time?