2012-05-09 20 views
0
<div id="nav"> 
    <ul id="rightMin"> 
     <li id="selectedmenu" onclick="location.href='index.php'">main</li> 
     <li onclick="location.href='aboutus.php'">about</li> 
     <li><a href="#">contact us</a></li> 
    </ul> 
</div> 

CSS:ID selectedmenuCSSの問題:同じ要素を持つ複数のCSSは

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

要素はCSS #selectedmenuかかりますが、ホバリング時にはdiv#nav ul li:hoverかかります。どのように私はそれがselectedmenu高い優先度付け#selectedmenu

答えて

0

でスティックを作ることができます。

div#nav ul li#selectedmenu { 
    ... 
} 
+0

ありがとうございます:) @ジョン –

1
div#nav ul li#selectedmenu:hover { 
    add your css rules here... 
} 
0

はちょうどそれをあなたがそれを置くたびに変更し、これを試してみてください。

div#nav ul li #selectedmenu:hover{ /* the style for #selectedmenu*/ } 

希望は、このことができます..

関連する問題