Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML How to Make a Website Creating HTML Content Create Navigation with Lists

Where does index.html take me when I visualize clicking <a href="index.html" ?


I want to know why add the attribute "index.html" when making a link for Portfolio and not "portfolio.html" instead.

Thank you,

Gerardo Davila

<!DOCTYPE html>
    <meta charset="utf-8">
    <title>Nick Pettit</title>
      <a href="index.html">
        <h1>Nick Pettit</h1>
      <p>&copy; 2013 Nick Pettit.</p>

1 Answer

Hi Gerardo, The "href" attribute in the <a> </a> tag requires a valid file path. However, the description/title could be different depending on the developer's choice. If I'm right, you are asking why the code was not written as:

   <a href="portfolio.html">
    <h1>Nick Pettit</h1>

but rather:

   <a href="portfolio.html">
    <h1>Nick Pettit</h1>

The reason is that the idea of the 'Portfolio' represents the content in the page rather than the filename of the html file. . In this case, the file is named 'index.html' but the content in it is relevant to that of a Portfolio - that's the reason why we used 'index.html' which represents the filename.

Also note that we did not create any file named 'portfolio.html' so if we had used that, it would have resulted in a dead link. However, depending on your choice, you can always rename the 'index.html' to 'portfolio.html' but just be conscious of which content you would want the 'href' to link to.

Hope this helps.

Thank you that answered my question

You are most definitely welcome Gerardo.