I can overwrite the BS5 stylesheet easy enough for :hover but when a user is on a certain page that the nav menu item refers to, I’d like this to show as the active color.
I can’t seem to find any CSS that achieves this. I’ve found some code online that uses JS but I would assume this is possible to do this without?
Essentially what I’m trying to achieve.
Nav menu items - change default color to ‘muted’. Then when hovered to a blue, and when active the same blue.
I’ve tried a few variations, the following works for hover but not active with ‘.navlm’ being my custom class I’m adding to the nav items. I’ve tried to be more specific with ids too but no luck:
What is the code used for your side menu? If it’s a nav component the Bootstrap navigation js file will automatically set the class .active to the nav item, corresponding to the current page.
When you inspect your element using browser dev tools do you see an active class assigned to it?
So what element are you applying your custom class to and what is your menu code exactly? Can you paste the code here as i can’t just guess where did you apply the class and what is your code (still don’t have a crystal ball)?
I think once you understand how CSS selectors “work” it will also be simple for you. The link that Ken provided is really useful if you are not sure how to target a specific element.