How to add background color to the active menu item with css (ie when I click on about link and go to about page I want that active menu item have red background)?
This is my code in Wordpress:
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation"> <ul class="nav navbar-nav"> <?php wp_nav_menu( array( 'theme_location' => 'main-menu', 'menu_class' => 'nav navbar-nav' ) ); ?> </ul> </nav> and this is my css:
.navbar-inverse .navbar-nav > li > a:visited { background: red !important; } But this css targets and "hover elements. What am I doing wrong?
activeclass or something similar to that. So you can target only that one class. It would be nice if you could provide a snippet of already generated navigation bar HTML.