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 GET LINK STAYING ACTIVE WHEN ON PAGE

Hi,

I have links which I have got to change when hover, but I want it to stay changed for when my users are on that page i.e. I hover over my orange coloured link, when I do it turns green, and when my I am on that page I want it to stay green until you move onto another page. Its not the pseudo active. Can anyone help?

Cheers

1 Answer

Are you talking about the way Treehouse has it on their navbar? Where right now the word Forum should be white and the others are faded??

If so, CSS isn't in charge of making that happen.

AHHHHH that explains alot! Cheers dude

Richard Duncan
Richard Duncan
5,568 Points

Actually you can do it with CSS you need to give your body tag an ID say this page or group of pages may have the ID of #forum.

Within your navigation give your anchor a ID also something like #menu-forum then with CSS do a rule as follows: -

body#forum #menu-forum a { color: #fff; font-weight: bold; }

Or in English, when body id = forum, menu-forum anchor = bold & white

cheers dude!