Search code examples
htmlcssdrop-down-menucss-float

css drop down menu collapses


https://i.sstatic.net/5tewm.png

my drop down menu goes under the next div element, any idea on how to fix this?

Css:

 .cf ul li{
float:left;
margin: 0;
padding: 0;
list-style:none;
font-family:"open sans", sans-serif;

}

.cf li a {
display:block;
padding:0 1em;
line-height: 2.5em;
color:#FFFFFF;
}

.cf li a:hover {
background-color:#ffa627;
}


li{
position:relative;
}
ul.submenu {
float:none;
background: #222;
position:absolute;
left:-9000em;
}

.topmenu li:hover ul{
left:0;
}   

ul.submenu li {
float:none;
}

#nav-bar nav {
background-color: #222;

}

.cf:before,
.cf:after {
content: " "; /* 1 */
display: table; /* 2 */
}

.cf:after {
clear: both;
}

/**
 * For IE 6/7 only
 * Include this rule to trigger hasLayout and contain floats.
 */
.cf {
    *zoom: 1;

.callout1 {
background-color: #fff; 
text-align: center; 
padding: 20px 0px;
width:319px;
text-decoration:none;
font-family: 'Open Sans', sans-serif;
color:#222;
border-right: 1px solid #EFEFEF; 
float:left;

}

HTML:

<div id="nav-bar" class="cf">
                <nav class="cf">
                    <ul class="topmenu">
                        <li class="hometop"><a href="#" class="hometop">Home</a></li>
                        <li ><a href="#" >Catagory</a>
                            <ul class="submenu">
                                <li><a href="#">Blah Blah</a></li>
                                <li><a href="#">Blah UGG</a></li>
                            </ul>
                        </li>
                        <li ><a href="#">About</a></li>
                        <li ><a href="#">How To Order</a></li>
                    </ul>
                </nav>

            </div>
<div id="extra-info">
                <nav>
                    <ul>
                        <li><a href="#" class="callout1">Do You Have Any Questions? <br>Contact Us</a></li>

First time making a website, pulling my hair out, trying to figure out this all day now, quick one of you dev wiz help meh please!

Edited: have pasted the "do you have any question contact us" div html as well as its css.


Solution

  • Try something like this. I hope this CSS class should work

    .cf{
       position:relative; 
       z-index:9999;
    }