Niek
Niek

Reputation: 1030

CSS Two Div's above one another

i'm trying to get two div's to float right against eachother, like this:

__________
|.menutop|
|        |
----------
|.menu   |
|        |
----------

How would i do that? I tried with:

.menutop{
position: absolute;
width:7%;
height:30px;
float:left;
margin-top:97px;

}
.menu{ 
position:relative;
width:7%; 
height:auto; 
float:left;
margin-top:107px;
}

But it makes .menu go on top of .menutop

Upvotes: 0

Views: 432

Answers (2)

Vaclav Kusak
Vaclav Kusak

Reputation: 124

.menutop
{
  width:7%;
  height:30px;
  float:left;
  margin-top:97px;
}


.menu
{ 
  clear: left;
  width:7%; 
  height:auto; 
  float:left;
  margin-top:107px;
}

Upvotes: 0

Marc B
Marc B

Reputation: 360572

You could put them into a container and float that:

<div class="menucontainer" style="float: left">
   <div class="menutop"></div>
   <div class="menu"></div>
</div>

Upvotes: 1

Related Questions