CSS CSS Layout Basics CSS Layout Project Introducing the Project

Nelson J
Nelson J
7,411 Points

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,652 Points

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

Nelson J
Nelson J
7,411 Points

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

1 Answer

Sean T. Unwin
Sean T. Unwin
28,652 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;
  }
}