Tag Archives: clear

Simple Clearing of Floats

Cool tip:

Got this from a friend of mine today. Is very simple and it does work on most of browsers.

” When you have two floated elements inside a container element, instead of adding a clearing DIV before the closing of the container element, you can try adding the following two CSS properties to the container:

display:  inline-block;
overflow: auto;

Tested this and it worked on IE 6, IE 7, Firefox and Safari.

Source of tip: http://www.sitepoint.com/blogs/2005/02/26/simple-clearing-of-floats/ (display: inline-block is not mentioned here, but I found it is needed for IE 6). “


Follow

Get every new post delivered to your Inbox.

Join 182 other followers

%d bloggers like this: