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 HTML First Use HTML Elements

Sergio Garcia
Sergio Garcia
7,875 Points

Question about <header> </header>

I dont understand what is wrong with this code:

<!DOCTYPE html>

<html>

  <head>
    <meta charset="utf-8">
    <title> Bugs life </tittle>
    </head>

<body>

    <header>
      <h1>Bugs</h1>
      <h2>life</h2>
    </header>

    <section>
      <p>ugs</p>
    </section>

    <footer>
      <p>life</p>
    </footer>

  </body>

  </html>

Hi Sergio,

I formatted your code for you. Some of it was stripped out.

Please see this thread on how to post code: https://teamtreehouse.com/forum/posting-code-to-the-forum

6 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Sergio;

Welcome to Treehouse!

It looks like if you are having questions with the header, section, and footer tag portion of this challenge you have gotten through to Task 6.

As a general rule, Treehouse challenges do not have you delete previously entered code in the code challenge, so once you put something in to get past a specific task it is generally required for subsequent tasks.

So, at the end of Task 5 your code should look similar to:

<!DOCTYPE html> <!-- Challenge Task 1: Create an HTML DOCTYPE tag -->

<html>                   <!-- Challenge Task 2: Create the HTML element that will serve as the document root. -->

  <head>                 <!-- Challenge Task 3a: Add the head and body elements to the page. -->

     <meta charset="UTF-8">    <!-- Challenge Task 4: Set the character set for the page. -->

      <title>Your Page Title Goes Here</title>   <!-- Challenge Task 5: Add a title element to the page. -->

  </head>               <!-- closing 3a -->

  <body>                <!-- Challenge Task 3b -->

  </body>              <!-- closing 3b -->

</html> <!-- Closing tag for Task 2 -->

Task 6 asks us to:

Add a header element, section element, and footer element.

These tags would go inside the body elements of our code. If you didn't catch this in the video take another look.

Happy coding,

Ken

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Sergio;

After Jason fixed your markup, I would say the issue for the code challenge is that you have an extra t in your closing </title> tag.

Ken

Beat me to it. :)

You have a typo on your closing </title> tag. You put "tittle".

I'll try to explain what happens in the browser for this type of error so that you may have a better chance of troubleshooting problems in the future.

What the browser does, at least in firefox, is include the rest of your html inside your title tag since it never finds a closing </title>.

Then it closes the title tag, closes the head, adds opening and closing body, then closes the html for you.

this is what it ends up producing in the browser:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Bugs life </tittle> </head> <body> <header> <h1>Bugs</h1> <h2>life</h2> </header> <section> <p>ugs</p> </section> <footer> <p>life</p> </footer> </body> </html></title>
</head>
<body></body>
</html>

You're able to pass task 5 because technically you do have a title element.

It doesn't pass task 6 though because it does not find the header, section, and footer elements. They were swallowed up in the title element.

Ken Alger
Ken Alger
Treehouse Teacher

This is a great example of why utilizing a text editor that does language specific tag closing is a big huge benefit. In mine, Sublime Text 2, it has saved me a lot of headaches of this type.

Robert Baker
seal-mask
.a{fill-rule:evenodd;}techdegree
Robert Baker
Full Stack JavaScript Techdegree Student 5,922 Points

Did you add the <body> tag right before the <header> tag and after the </footer> tag?

It should be:

<body>
<header>  </header>
<section>  </section>
</footer> </footer>
</body>

Also you appear to be missing a few more elements.

<!DOCTYPE html>
<html>
<head></head>
<body>

(header, section, footer tags go in here)

</body>
</html>

(edit: I don't know why the 2nd HTML code isn't working for me. Can't they just use [code] [/code] in the forums please? )

Sergio Garcia
Sergio Garcia
7,875 Points

Awesome, thank you everyone!!! Appreciate much !! Ken, Robert and Jason!

Sergio Garcia
Sergio Garcia
7,875 Points

Awesome, thank you everyone!!! Appreciate much !! Ken, Robert and Jason!