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 Layout Basics CSS Layout Project Introducing the Project

What's wrong with my nav at tablet and phone size, also am I doing it wrong for not targeting desktop with @media?

My navbar won't display each item on its own line at phone size. I have applied display block and tried a bunch of other stuff but I can't get it to work. I haven't targeted desktop size using @media queries, it's that ok? Sorry a bunch of questions but I am overwhelm.

Screenshot: https://w.trhou.se/sdojp0ntgn

Thank you very much.

Sean T. Unwin
Sean T. Unwin
28,690 Points

Could you post the HTML for the nav as well as the relevant CSS so we can take a look, please.

Sean T. Unwin I updated it. Sorry forgot to include the link.

1 Answer

Sean T. Unwin
Sean T. Unwin
28,690 Points

A couple of small edits in the media query, and you should be good.

@media (max-width: 769px) {

  /* ... */

  /* Edit the following to comment or remove `text-align: center` */
  .main-nav {
    /* text-align: center; */
    display:block;
  }

  /* Add the following */
  .main-nav li {
    float: none;
  }
}