Jump to content

How to give the active item in the navigation bar an other color


Andreas De Rudder

Recommended Posts

Hallo,

 

I have on my website a horizontal navigation bar in black. By hoovering an item it becomes grey. But I want now that the active item which page is shown will be red. But it doesn't work. The item only becomes red as long as you are clicking it, but when you leave it it becomes black again. I want it to be red all the time that you are visiting that page.

 

This is the css that I have:

 

#menu ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #111;
}

#menu li {
float: left;
}

#menu li a {
display: block;
color: white;
text-align: center;
padding: 7px 7px;
text-decoration: none;
font-size: 90%;
}

#menu a:hover {
background-color: #808080;
}

#menu a:active {
background-color: red;
}

 

What do I have to change?

Edited by Andreas De Rudder
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...