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 Styling Web Pages and Navigation Polish the Navigation and Footer

Sam Mercer
Sam Mercer
2,222 Points

Spacing issue when when editing navigation css

Hi, sorry for the newbie question but I just can't seem to solve this. When adding padding to the nav anchors I am getting a large space above the nav and the whole lot is pushed over to the right. Thanks!

https://w.trhou.se/w0x1mymt2p

2 Answers

Wolfgang Warneke
Wolfgang Warneke
10,845 Points

In the header, your <a> tag for the <h1> and <h2> is also wrapped around the who <nav> tag, which contains other anchor tags, causing the strange browser behavior (don't do nested links), for how you have it the right now, try closing it after your <h2>

<header>
      <a href="index.html" id="logo">
        <h1>Sam Mercer</h1>
        <h2>Designer</h2>
      </a>
      <nav>
        <ul>
          <li><a href="index.html" class="selected">Portfolio</a></li>
          <li><a href="about.html">About</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>  
      </nav>
</header>
Sam Mercer
Sam Mercer
2,222 Points

Thank you Wolfgang that's fixed it! How did you work out the problem?