July 16, 2008...8:00 am

Clearing Float

Jump to Comments

Are you having trouble with float property? Well, you can use clear:both by adding another div into your markup.

<div class=”clearFix” style=”float:left”>Floated DIV</div>

<div style=”clear:both”>Clear float</div>

But what if I don’t want to do any structural changes, then it’s time to switch to CSS 2.

.clearFix:after{
content: “.”;
display: block;
height: 0;
clear: both;
visibility: hidden;
}

All “STANDARD” browser has support for this property. For more details & browser support I will suggest to visit Positioniseverything.


Bookmark and Share

Leave a Reply