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

CSS How to Make a Website Adding Pages to a Website Add a New Page

why do I remove the class selector from the portfolio anchor and move it to about...

what would this do to my css page when stating the class selected... wouldn't it change the about link the same as the portfolio link at that point?

3 Answers

David Diehr
David Diehr
16,457 Points

I see you posted this a while ago, and I imagine you've probably got an answer but just in case. The reason you move the class selector from one line to the other is to move where the css styling is being applied. When your browser is reading the index page, it will apply that css to where the selector is at on that page (the index link) and when you're on the about page it will apply it to where you have it on that page (the about link). You just gotta remember these are different pages, so the links on them are different (even though we think of the header of the website as not changing, it's actually two different headers on two different pages connected by link) changing one on one page won't change it on the other. It's when you change the css that's applied to multiple pages that you change two pages at once. But in this case, you are only changing the html.

hello ,

you can remove it manually on each page for example

here in index.html

<nav>
        <ul>
          <li><a href="index.html" class="selected">Portfolio</a></li>
          <li><a href="about.html">About</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>
      </nav>

here in about.html

<nav>
        <ul>
          <li><a href="index.html">Portfolio</a></li>
          <li><a href="about.html" class="selected">About</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>
      </nav>

here in contact.html

<nav>
        <ul>
          <li><a href="index.html">Portfolio</a></li>
          <li><a href="about.html">About</a></li>
          <li><a href="contact.html" class="selected">Contact</a></li>
        </ul>
      </nav>

Or you can try create a function through javascript ,

Best regards

that wasn't my question..