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

Gilad Goldman
Gilad Goldman
5,639 Points

Nav menu items stacking

Hi there,

I am having an issue with my site with a page width between 660 and 780 pixels.

It is as if the menu items in the nav element do not have enough room to display on a single line at this page size.

I have been designing the site as per the lessons and still can't find where I have gone wrong.

Is someone able to assist me in figuring out what I have done wrong? It is almost as is the header is taking up more width across the page that it should.

Gilad Goldman
Gilad Goldman
5,639 Points

Below is a copy of my responsive.css file.

@media screen and (min-width: 480px) {

  /**********************************
         TWO COLUMN LAYOUT
**********************************/

  #primary {
   width: 50%;
   float: left;
  }
  #secondary {
   width: 40%;
   float: right;
  }

/**********************************
 MARGIN SPACING
  3 *  5  = 15
  100-15 = 85%
  85% / 3 = 28.333333333%
**********************************/


/**********************************
        PORTFOLIO PAGE
**********************************/

  #gallery li {
   width: 28.3333% 
  }

  #gallery li:nth-child(4n) {
   clear: left; 
  }

/**********************************
        ABOUT PAGE
**********************************/  

.profile-photo{
    float: left;
    margin: 0 5% 80px 0;
  }

}


@media screen and (min-width: 660px) {

/**********************************
            HEADER
**********************************/ 

nav {
    background: none;
    float: right;
    font-size: 1.125em;
    margin-right: 5%;
    text-align: right;
    width: 45%;
  }

#logo {
    float: left;
    margin-left: 5%;
    text-align: left;
    width: 45%;
  }

 h1 {
    font-size: 2em;
  }

 h2 {
   font-size: 0.9em;
    margin-bottom: 20px;
  }

  header {
    border-bottom: 4px solid #599a68;
    margin-bottom: 60px;
  }

}

1 Answer

Gilad Goldman
Gilad Goldman
5,639 Points

I have made a change to the header width that seems to have resolved this. Was this the best way of doing this?

/**********************************
            HEADER
**********************************/ 

nav {
    background: none;
    float: right;
    font-size: 1.125em;
    margin-right: 5%;
    text-align: right;
    width: 55%;
  }

#logo {
    float: left;
    margin-left: 5%;
    text-align: left;
    width: 30%;
  }

 h1 {
    font-size: 2em;
  }

 h2 {
   font-size: 0.9em;
    margin-bottom: 20px;
  }

  header {
    border-bottom: 4px solid #599a68;
    margin-bottom: 60px;
  }

}