How do I make links in navigation bar highlight when I click/scroll to the relevant section of the page?


I need help with a project (link above). So, when I hover over a link in the navigation, it hightlights, no problem there. But I want it to remain hightlighted when I am looking at the relevant section or when I scroll through the page, it hightlights the relevant link. Is that possible with CSS only?

I haven’t learned Javascript yet so I don’t want to use JS.


I don’t thing that you can do that with just CSS and HTML. You might have to use Javascript or some library like jquery. I don’t know if bootstrap has such a feature.
We you surely have done a lot of work in the website great.

Have you looked into :active and :visited?

I tried both but it doesn’t do what I want it to do. Thanks for the suggestion though.

I think it can’t be done without Javascript.

Yes, I think I may need Javascript. It would have been better with this feature but still good as it is.