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 Creating HTML Content Create Navigation with Lists

Carol B
Carol B
842 Points

I can't work this one out

I'm sure it's right: <nav> <ul>Portfolio</ul> <ul>About</ul> <ul>Contact</ul> </nav>

Hi Carol,

Your html has been stripped out.

This should help you post it correctly: https://teamtreehouse.com/forum/posting-code-to-the-forum

9 Answers

Carol,

You have created three unordered lists <ul> with no list items <li> inside of them.

The general format for an unordered list would be:

<ul>
    <li>Item 1</li>
    <li>Item 2</li>
   <li>item 3</li>
</ul>

So you want a single unordered list with 3 list items inside of it.

Does that make sense?

Carol B
Carol B
842 Points

Sorry, total newbie

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Nick Pettit</title>
  </head>
  <body>
    <header>
      <a href="index.html">
        <h1>Nick Pettit</h1>
        <h2>Designer</h2>
      </a>
      <nav>
        <ul>Portfolio</ul>
        <ul>About</ul>
        <ul>Contact</ul>
      </nav>
    </header>
    <section></section>
    <footer>
      <p>&copy; 2013 Nick Pettit.</p>
    </footer>
  </body>
</html>
pavelzharnikau
pavelzharnikau
3,690 Points

Compare with this. Feel free to ask any questions about why this code is correct.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Nick Pettit</title>
  </head>
  <body>
    <header>
      <a href="index.html">
        <h1>Nick Pettit</h1>
        <h2>Designer</h2>
      </a>
      <nav>
        <ul>
          <a href="index.html"><li>Portfolio</li></a>
          <a href="about.html"><li>About</li></a>
          <a href="contact.html"><li>Contact</li></a>
        </ul>
      </nav>
    </header>
    <section></section>
    <footer>
      <p>&copy; 2013 Nick Pettit.</p>
    </footer>
  </body>
</html>
```html

Pavel,

You have posted invalid html here. You can't have links around list items. The only direct children of a <ul> can be <li>'s or scripts.

Carol B
Carol B
842 Points

everything was correct until I had to do this: "Inside the navigation element, create three list items with the words, “Portfolio”, “About”, and “Contact”. Don’t add links yet."

pavelzharnikau
pavelzharnikau
3,690 Points

Try to think about this task in this way.

We have a navigation element:

<nav>
</nav>

Now we need to create an unordered list inside our nav-element:

<nav>
        <ul>
        </ul>
</nav>

Done. Now we create 3 list items (li):

<nav>
        <ul>
          <li>Portfolio</li>
          <li>About</li>
          <li>Contact</li>
        </ul>
 </nav>
Carol B
Carol B
842 Points

Thanks Pavel! I got it. I was using the ul like it was li. Much appreciated.

Carol B
Carol B
842 Points

Thanks Pavel! I got it. I was using the ul like it was li. Much appreciated.

Carol B
Carol B
842 Points

And thanks Jason - yeah I see what you mean re Pavel's code. Thanks to both of you, I got it. Such a dumb mistake by me hehehe. Sometimes the small things trip me up, while I get the big things. Thanks both of you for your time.

pavelzharnikau
pavelzharnikau
3,690 Points

Jason Anello, thanks a lot. But the checker "eats" this code. And I was sure it was right.

<li><a href="#">Something1</a></li>
<li><a href="#">Something2</a></li>

I will write to support, cause this can be a common mistake for people new-to-html like me.

What do you mean? the challenge is letting incorrect code pass or the code you thought was correct is not passing? Sorry, I'm a little confused here.

You have the links correctly inside the list items. Task 3 has specific file names that each link should go to so you can't use href="#" You have to replace # with the correct filename.

pavelzharnikau
pavelzharnikau
3,690 Points

The code above, which was incorrect as you explained me, fit to the challenge. I checked it once more, and it has passed. So I think that it can confuse other people like it has confused me.

P.S.Sorry for my English, I'm from Belarus)

No need to apologize about your English.

I understand now and you're right. Good catch! I just checked myself and it passes with both the valid and invalid html.

You should email support about this. Include a link to the challenge.

It makes more sense to me now why I've seen a few people posting that invalid code when helping other people. They must have passed the challenge incorrectly like you did and went on believing that was the right way to do it.

pavelzharnikau
pavelzharnikau
3,690 Points

Yes, now I understand it too. I've looked through my notes and find this error again. I think, for me it will be a good practice to double-check syntax with http://www.w3.org. In case of such mistakes.

I'm not sure if you're up to the point in the project where you're shown the validator at the w3c but you can paste your code above into the validator to get some experience with how the errors are. It's going to show a few warnings on there too which you can ignore.

http://validator.w3.org/#validate_by_input

pavelzharnikau
pavelzharnikau
3,690 Points

Thanks a lot! I'll try this.

pavelzharnikau
pavelzharnikau
3,690 Points

The code above, which was incorrect as you explained me, fit to the challenge. I checked it once more, and it has passed. So I think that it can confuse other people like it has confused me.

P.S.Sorry for my English, I'm from Belarus)