I am working on a header that contain a brand logo and a navigation. The header itself is contained in a div named container. The markup is like -
<div class="container">
<div class="head">
<div class="brand>Brand Name</div>
<div class="nav'>Nav content Here</div>
</div>
</div>
The CSS I am using is like
.container{
width:100%;
margin:10% auto;
}
.head{
float:left;
width:100%
}
.brand{
float:left;
margin:0 3%;
width:auto;
}
.nav{
float:right;
margin:0 3%;
width:auto
}
The Problem is that the all the content flows out of the Main container <div>
and the container takes a height of 0px. The content is displaying as i want it to be but the main container is taking a height of 0px.
I want to display the brand logo and the navigation side by side. It would be great if you could make a fiddle with the code. Thanks in advance.
EDIT: Sorry for not researching before posting the question. The Clearfix hack is a life saver but there were several different ways also. Listed here - How do you keep parents of floated elements from collapsing?