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 Portfolio styling, need help!

I've been following the tutorial on how to create and deploy a website and I'm having some trouble with the NAV. Instead of the NAV being in a border that stretches across the entire screen, it's contained within three separate boxes.

Not sure what the specific CSS would be to change this, I'm a green horn to coding and could do with a nudge in the right direction.

8 Answers

Post your code. Click on the cheatsheet below the reply box so you can post the code easily.

Both HTML and CSS, as well :)

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


nav ul {

  margin: 0px 10px;
  padding: 0;

  }

nav li {
display: inline-block;
}

nav a {
  font-weight: 800;
  padding: 15px 10px
}
    <nav>
      <ul>
         <li><a href="index.html" class="selected">Portfolio</a></li>
         <li><a href="about.html">About<a/></a></li>
         <li><a href="contact.html">Contact</a></li>
      </ul>
    </nav>

The nav borders the li elements like it's supposed to. The li elements are the items that are sectioned off in 3.

I've downloaded the CSS file and renamed it so I can compare the two and the code is the same, I'm not sure if there's an issue somewhere else further down.

So imagine this: The nav is a box that's spanning the screen from left to right and containing 3 separate boxes, the 3 li's. Are you trying to make sure those 3 li's span the screen from left to right within the nav box?

alt text

https://ibb.co/b7DFyF

The top bar is what the NAV looks like with my code. The second bar in the image is how it should look.

One of the problems is your HTML. You have an extra </a> after About.

Don't forget to close out your nav a padding style. You forgot a semi-colon there.