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: (display: inline-block is not mentioned here, but I found it is needed for IE 6). “

About mcloide

Making things simpler, just check: View all posts by mcloide

Leave a Reply

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

You are commenting using your 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: