Jump to content

How to change the link background color when I am on the page


newcoder1010

Recommended Posts

Hi,

 

HTML:

<ul class="menu nav">

<li class="first leaf "><a href="xxx.com/maryland">Maryland</a></li>
<li class="leaf child-menu-item"><a href="xxxx.com/bal">Baltimore, MD</a></li>
<li class="leaf child-menu-item"><a href="xxx.com/mont" class="child-menu-item">Montgomery County, MD</a></li>
</ul>

I have this css works for hover:

.nav > li > a:hover {background:red;}

I also like to have the same background color when I visit each page. Below code does not work.

.nav > li > a:active{background:red;}

Please advise.

Edited by newcoder1010
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...