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:

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

The element with the ID selectedmenu takes CSS #selectedmenu but when hovering it takes div#nav ul li:hover. how can i make it sticks with #selectedmenu

3 Answers 3

1
div#nav ul li#selectedmenu:hover {
    add your css rules here...
}
Sign up to request clarification or add additional context in comments.

Comments

0

Give selectedmenu a higher precedence:

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

Comments

0

just change it every time you hover it, try this:

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

hope this helps..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.