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 Use the Navigation Element

Xian Zhou
PLUS
Xian Zhou
Courses Plus Student 229 Points

Anchor element in header

In the video, the teacher wrote: <header> <a href="index.html"> <h1>Nick Pettit</h1> <h2>Designer</h2> </a> .......... when it shows in the webpage, I only see the "Designer" on top of the page with default blue colour. I don't understand since this anchor wraps two sentences, one is "Nick Pettit", one is "Designer", why it only shows "Designer" on the webpage.

Xian Zhou
Xian Zhou
Courses Plus Student 229 Points

I need to correct the code, the teacher wrote:

        <a href="index.html>
           <h1>Nick Pettit</h1>
           <h2>Designer</h2>
        </a>

1 Answer

Xian- If I understand you correctly, you want to correct your code in your Workspace so that both Nick's name and Designer are present on the web page.
The code for that lesson that I saved in my Workspace was the following:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
</head>
  <body>
    <header>
      <a href="index.html">
        <h1>Nick Pettit</h1>
        <h2>Designer</h2>
      </a>
</body>
  </html>

Hope this is helpful.

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <header> <a href="index.html"> <h1>Nick Pettit</h1> <h2>Designer</h2> </a> </body> </html>