Sunday, 18 August 2013

float:right causes parent div to shrink

float:right causes parent div to shrink

<div style="width:50%;" class="outerdiv">
<div style="">
<div style="display:inline;">
<span><?php echo __('Baþlýk :', 'goldmem');?></span>
</div>
<div style="display:inline; float:right;">
<input class="postptext" type="text" id="posttitle">
</div>
</div>
</div>
I have this layout. Outerdiv has borders so I can see it's size change.
This is the result :
Without float : http://i.imgur.com/F73U0jX.png?1
With float :http://i.imgur.com/8berzkN.png?1
How can I make it so that the size of the div contains all the elements.

No comments:

Post a Comment