not able to style a ul inside a nav tag

Posted by user1831677 on Stack Overflow See other posts from Stack Overflow or by user1831677
Published on 2012-11-17T10:44:42Z Indexed on 2012/11/17 11:02 UTC
Read the original article Hit count: 232

Filed under:
|

I am trying to make a nav menu for my website and have been using http://www.onextrapixel.com/2011/06/03/how-to-create-a-horizontal-dropdown-menu-with-html-css-and-jquery/ as a guide. It has worked fine but as soon as I try to add ( id="coolMenu" ) to the nav tag it stops working.

I took it away from the ul tag and added it to the nav tag and it no longer works. It does not display anything at all. What am in doing wrong?

Thanks.

html code below:

<nav id="coolMenu">
<ul>
    <li><a href="#">Lorem</a></li>
    <li><a href="#">Mauricii</a></li>
    <li> 
        <a href="#">Periher</a>
            <ul class="noJS">
                <li><a href="#">Hellenico</a></li>
                <li><a href="#">Genere</a></li>
                <li><a href="#">Indulgentia</a></li>
            </ul>
    </li>
    <li><a href="#">Tyrio</a></li>
    <li><a href="#">Quicumque</a></li>
</ul>
</nav>

css below:

/* Structure
------------------------------------------*/
#coolMenu,
#coolMenu ul {
    list-style: none;
}
#coolMenu {
    float: left;
}
#coolMenu > li {
    float: left;
}
#coolMenu li a {
    display: block;
    height: 2em;
    line-height: 2em;
    padding: 0 1.5em;
    text-decoration: none;
}
#coolMenu ul {
    position: absolute;
    display: none;
    z-index: 999;
}
#coolMenu ul li a {
    width: 80px;
}
#coolMenu li:hover ul.noJS {
    display: block; 
}


/* Main menu
------------------------------------------*/
#coolMenu {
    font-family: Arial;
    font-size: 12px;
    background: #2f8be8;
}
#coolMenu > li > a {
    color: #fff;
    font-weight: bold;
}
#coolMenu > li:hover > a {
    background: #f09d28;
    color: #000;
}


/* Submenu
------------------------------------------*/
#coolMenu ul {
    background: #f09d28;
}
#coolMenu ul li a {
    color: #000;
}
#coolMenu ul li:hover a {
    background: #ffc97c;
}

© Stack Overflow or respective owner

Related posts about html

Related posts about css