2012-04-14 98 views
0

如何通过css防止悬停按钮,div,li如果它已经处于活动状态?防止悬停在活动状态

#list-of-tests .item-test:hover { 
    background-color: #4d5f75; 
    border: solid 1px #4d5f75; 
} 

#list-of-tests .item-test:active { 
    background-color: #93c3cd; 
    border: solid 1px #93c3cd; 
} 

回答

3

两种方式:

1)使用!important:active状态:

#list-of-tests .item-test:active { 
    background-color: #93c3cd !important; 
    border: solid 1px #93c3cd !important; 
} 

2)指定多个状态:

#list-of-tests .item-test:active, 
#list-of-tests .item-test:active:hover { 
    background-color: #93c3cd; 
    border: solid 1px #93c3cd; 
} 
+0

那的作品!非常感谢! – 2012-04-14 17:44:29