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

HTML How to Make a Website Responsive Web Design and Testing Adjust the Profile Page and Header

Catherine Cameron
Catherine Cameron
2,929 Points

Nav bar will not align with logo

On 660px and above, the nav bar will not align with the logo. It stacks underneath name and 'Designer'. I have no idea what I did wrong.

Here's my responsive.css

@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 {
    margin-left: 5%;
    text-align: left;
    width: 45%;
  }

  h1 {
    font-size: 2.5em;
  }

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

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

}
Catherine Cameron
Catherine Cameron
2,929 Points

here is my main.css as well

/********************************
HEADING
*********************************/


header {
  float: left;
  margin: 0 0 50px 0;
  padding: 5px 0 0 0;
  width: 100%;
}

#logo {
  text-align: center;
  margin: 0;
  padding: 0;
}

h1 {
  font-family: 'Changa One', sans-serif;
  margin: 0;
  padding: 15px ;
  font-size: 1.75em;
  font-weight: normal;
  line-height: 0.8em;
}

h2 {
  font-size: 0.75em;
  margin: -5px 0 0 20px;
  font-weight: normal;
}



/********************************
NAVIGATION
*********************************/

nav {
  text-align: center;
  padding: 10px 0;
  margin:: 20px 0 0;
}

nav ul {
  list-style: none;
  margin: 0 10px;
  padding: 0;
}

nav li {
  display: inline-block;
}

nav a {
  font-weight: 800;
  padding: 15px 10px;
}

2 Answers

Hi, I noticed a few things missing in your code. First, I think you're missing a semi-colon after width: 45% in your nav rule and after margin-bottom: 20px in your h2 rule. However, think CSS will be forgiving of that, so you won't see any visual changes in your browser. I also noticed that you are missing float: left; in you #logo rule. That causes your nav to shift down, increasing the overall size of your header. Does that help?

Catherine Cameron
Catherine Cameron
2,929 Points

Thanks Antonio! That fixed the alignment problem, but pushed the nav to the top. Put some padding and now it looks great!