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;
}
4

1 回答 1

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;
}
于 2012-04-14T17:40:51.680 回答