Update: Why the divs are appearing as they do is more important than how to remove the problem. If I don't know why the divs are appearing the way they do I won't get an understanding of how the divs work.
I have two div
's: menuContainer
and top
, and they are wrapped in another div
called topContainer
.
I want menuContainer
and top
to be under one another vertically, not on the X angle (and I thought it was standard for divs to appear under one another) but they appear both on top of each other and "inline".
This is what it looks like in my browser (yes I've f5:ed and the fiddle shows the same thing):
menuContainer
is a wrapper for a horizontal CSS menu. I want it to appear as tabs on top of the white area that is top
Why are the divs appearing "inline" (look at where hello is located) and how do I edit it to look like I want it to?
body {
background-color: #c2b074;
color: #40371c;
margin: 0px;
font-family: Calibri;
}
/* Menu CSS */
#menuContainer {
margin: 4em auto;
background-color: #000000;
width: 600px;
}
#navMenu {
margin: 0px;
padding: 0px;
}
#navMenu ul {
margin: 0px;
padding: 0px;
list-style-type: none;
text-align: center;
background-color: #d4cbab;
}
#navMenu li {
display: inline;
}
#navMenu a {
float: left;
text-decoration: none;
color: #40371c;
width: 6em;
padding: 0.3em;
margin: 0 1.2em 0 0;
background-color: #d4cbab;
border-radius: 10px 10px 0px 0px;
}
#navMenu a:hover,
#navMenu a#cart:hover,
#navMenu a#contact:hover,
#navMenu a#home:hover {
background-color: #efefef;
color: #40371c;
}
#navMenu a#current {
background-color: #efefef;
}
#navMenu a#contact {
background-color: #d4cbab;
}
#navMenu a#cart {
background-color: #6a6145;
color: #c2b074;
}
#navMenu a#home {
background-color: #40371c;
}
/* Top content CSS */
#top {
clear: left;
width: 650px;
height: 100px;
margin: 0 auto;
background-color: #efefef;
border-radius: 10px 10px 0px 0px;
}
<div id="topContainer">
<div id="menuContainer">
<div id="navMenu">
<ul>
<li> <a href="index.html" id="current">Home</a>
</li>
<li> <a href="#" id="contact">Contact</a>
</li>
<li> <a href="#" id="cart">Cart</a>
</li>
</ul>
</div>
</div>
<div id="top">
Hello
</div>
</div>
The tutorial the CSS menu is based on is this one.