2012-04-14 97 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