Clearing HTML floats for all browsers including IE, Firefox, Safari mac and pc

December 7, 2006

I had the problem of two div floats and having the text below clear them in all browsers. After finding this article: http://positioniseverything.net/easyclearing.html my quick solution was this:

<div>

<div style=”float:left;”></div>

<div style=”float:right;”></div>

<br style=”clear:both”/>

</div>

The key here is that the float elements are contained in their own DIV and a BR tag is used to clear the floats. Those two tricks allow this to work in all browsers.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: