-3

I have nav menu with few anchors. For example "HOME" "ABOUT" and "CONTACT"

I have the next question.

If I am on "HOME" page, I want to style "HOME" anchor on this page differently, and the same for other pages and their anchors respectively.

One of my ideas was to style each page separately, using :nth element?

But maybe someone knows another way to do that.

PS: Sorry, I was not clear, I don't want to change the color, I need to add the underline. So it is not duplicated question

Vasyl Kozhushko
  • 83
  • 3
  • 11

1 Answers1

1

the best way is to add an active class to the current page. This way you will be able to add some style on your home nav if you are on the home page. I don't know your stack, but could be done by your server side, or by javascript.

sheplu
  • 2,937
  • 3
  • 24
  • 21