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 Build a Responsive Website Adaptive Design Implementing Media Queries

Andrew Probert
Andrew Probert
1,862 Points

Nav element not displaying properly with media query

It looks like I've added the exact same code to my stylesheet as shown on the video to make the nav element adaptive for the iphone display, but when I resize my browser its not working. Here's my css:

\\css /media queries/ /iphone/ @media screen and (max-width: 480px) { .grid_1, .grid_2, .grid_3, .grid_4, .grid_5, .grid_6, .grid_7, .grid_8, .grid_9, .grid_10, .grid_11, .grid_12 { width: 100%; } #nav ul { margin: 5% 0; } #nav ul li { float: left; margin: 5% 0; } #nav ul li.about { width: 20%; } #nav ul li.pricing { width: 50%; } #nav ul li.locations { width: 30%; } #nav ul li.last { width: 100%; margin: 0; font-size: 1em; } } \\

Here's my html:

\\html <div class="grid_8 omega"> <ul class="nav"> <li class="about"><a href="#">About</a></li> <li class="pricing"><a href="#">Cupcakes & Prices</a></li> <li class="locations"><a href="#">Locations</a></li> <li class="last"><a href="#">Contact Us</a></li> </ul> </div>