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.
Jason Larkin
13,970 PointsFloating 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
10,972 PointsIf 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
13,970 PointsYou're right; thank you it works now.