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 Unused CSS Stages Media Queries Adaptive Layouts with Media Queries

Jason Larkin
Jason Larkin
13,970 Points

Floating div elements in media query not working

@media screen and (min-width:769) {
  .logo { 
    float:left; } 
  .main-nav {
    float:right;}

.main {
    width: 40.425531914894%;
}
.extra {
    width: 23.404255319149%;
  display:block;
}}

The above code should be right, but isn't. I'm trying to float two elements at 769 px but it isn't working. Thank you in advance for any replies.

2 Answers

Chase Lester
Chase Lester
10,972 Points

If this is the exact code, you forgot to specify the min-width unit. 769px.

You can also see if the media query is working initially by changing the background color in your body -- body{background-color:yellow;}, then when you resize to that width, yellow should display and you will know you have the media query working.

Jason Larkin
Jason Larkin
13,970 Points

You're right; thank you it works now.