CSS问题:具有相同元素的多个CSS

CSS问题:具有相同元素的多个CSS,css,Css,ID为selectedmenu的元素采用CSS#selectedmenu,但悬停时采用div#nav ul li:hover。如何使其与#selectedmenu保持一致,使selectedmenu具有更高的优先级: #selectedmenu { display:inline; float:right; /*padding: 2px 7px 0px 7px;*/ height: 35px; background: url('../images/selec

ID为
selectedmenu
的元素采用CSS
#selectedmenu
,但悬停时采用
div#nav ul li:hover
。如何使其与
#selectedmenu

保持一致,使
selectedmenu
具有更高的优先级:

#selectedmenu {
    display:inline;
    float:right;
    /*padding: 2px 7px 0px 7px;*/
    height: 35px;
    background: url('../images/selected.png') repeat-x;
    cursor: pointer;
    text-align: center;
    line-height:35px;
    padding: 0 5px 0 5px;
    color: white;
}
div#nav ul li {
    display:inline;
    float:right;
    /*padding: 2px 7px 0px 7px;*/
    height: 35px;
    cursor: pointer;
    text-align: center;
    line-height:35px;
    padding: 0 5px 0 5px;
}

div#nav ul li:hover {
    background: #232323;
    color:#fff;
}

每次悬停时都要更改,请尝试以下操作:

div#nav ul li#selectedmenu:hover {
    add your css rules here...
}
希望这有帮助

div#nav ul li#selectedmenu {
     ...
}
div#nav ul li#selectedmenu:hover {
    add your css rules here...
}
div#nav ul li #selectedmenu:hover{ /* the style for #selectedmenu*/ }