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

My entire header is a hyperlink, and I'm not sure why.

This is the first site I have attempted to put together on my own after going through the "Build a Website" course. Everything is actually going pretty good, but I can't seem to figure out this one.

In the code, I have a header element to house a h1, and h3 element. I used my hyperlink to bracket the h1 an h3, but it appears to have affected the entire header. ( I should note that this is not effecting my nav. just my h1 and h3 elements, as intended, as well as the entire length of the header, 100% of the page. I'm just looking to make the area near the actual text a hyperlink. )

here is the code

<a href="index.html">
    <h1>Website Name</h1>
    <h3>Under construction!</h3>
</a>
    <nav>
        <ul>
            <a href="index.html"><li>Home</li></a>
            <a href="shows.html"><li>Shows</li></a>
            <a href="funnies.html"><li>Funnies</li></a>
            <a href="about.html"><li>About</li></a>
            <a href="contact.html"><li>Contact</li></a>
        </ul>
    </nav>
</header> 

and the css

header { width: 100%; text-align: center; background-color:#666666;

h1, h3 { max-width: 500px; margin: 0 auto;

}

h1 { font-size: 4em; font-family: 'Roboto', sans-serif; }

h3 { font-size:2em; font-family: 'Kaushan Script', cursive;

2 Answers

First, I don't see an opening header tag.

Second, try moving your anchor tags to the inside of the headline and list elements.

I hope this helps!

<header>

    <h1><a href="index.html">Website Name</a></h1>
    <h3><a href="index.html">Under construction!</a></h3>

    <nav>
        <ul>
            <li><a href="index.html">>Home</a></li>
            <li><a href="shows.html">Shows</a></li>
            <li><a href="funnies.html">Funnies</a></li>
            <li><a href="about.html">About</a></li>
            <li><a href="contact.html">Contact</a></li>
        </ul>
    </nav>
</header> 

ha! There is an opening header tag, I just checked. I must have missed it when copying the code. Eureka. You've solved it old chap. Thanks for the speedy reply, that was bugging the crap out of me. I seem to have forgotten that the hyperlink does not have to encompass the entire element, only the information within it.

You're very welcome. :)