Reputation: 1
i have 3 div in my page. named with blok1, blok2 and blok3.
i'm adding to {float:left;} for blok1 div but getting this result:
i want to get this result.
Upvotes: 0
Views: 1097
Reputation: 55
you should probably have it like this
#blok1 {float:left;}
#blok2 {float:right;}
#blok3 {clear:both;}
or ideally
If you want it like in a column, you should use it like this.
#ltCol {float:left;}
#rtCol {float:right;}
<div id="ltCol">
<div id="blok1"></div>
<div id="blok1"></div>
</div>
<div id="rtCol">
<div id="blok2"></div>
</div>
<div style="clear:both;"></div>
Upvotes: 0
Reputation: 36629
Try this:
<style type="text/css">
#wrap div {
border: 1px solid #000;
float: left;
margin: 5px;
padding: 5px;
}
#div3 { clear: left; }
</style>
<div id="wrap">
<div id="div1">div1</div>
<div id="div2">div2</div>
<div id="div3">div3</div>
</div>
Upvotes: 2
Reputation: 6009
you should add the float attribute to blok1 and blok2 in order to get one next to the other.
note: each div have to have a defined width and height.
Upvotes: 0
Reputation: 17319
instead of http://jsfiddle.net/JmWZp/1/
just use a display:table; on the divs
Upvotes: 0