lakshmen
lakshmen

Reputation: 29064

How to hover over the whole button in css

When I hover over the whole button, I would like it to appear over the whole button. Because the button has a background image, i am not able to do it correctly. The buttons looks like these:

enter image description here

The CSS appears like this:

#tablist{
  padding: 0px auto 0px auto;
  height: 32px;
}

#tablist li{
    display: block;
    width: 150px;
    height: 35px;
    float: left;
    border-radius: 7px; 
    -moz-border-radius: 7px; 
    -webkit-border-radius: 7px; 
    margin: 0px auto 0px auto;
    text-align: center;
    padding-top: 5px;
    cursor: hand; 
    cursor: pointer;
}

#tablist ul:hover{
 background-color: red;
}

.tablink{
  text-decoration:none;
}

.locked{
    background: url('../img/DashboardButtonsLocked.png') no-repeat;
    background-position:5px -85px;
}
.unlocked{
    background: url('../img/DashboardButtonsLocked.png') no-repeat;
    background-position:4px -2px;
}

How do i correct it? Need some guidance over it.

Upvotes: 0

Views: 812

Answers (2)

Rohit Azad Malik
Rohit Azad Malik

Reputation: 32172

Hey i think you should give to #tablist li:hover

As like this

#tablist li:hover{
 background-color: red;
}

Upvotes: 1

gabitzish
gabitzish

Reputation: 9691

Try overriding the background property at hover:

#tablist ul:hover{
   background: red;
}

Here is a demo : http://jsfiddle.net/taQfU/

Upvotes: 1

Related Questions