CSS : “float” property vs “Display:inline-block”

I confess that I’ve never worked with the CSS attribute “display: inline-block“, I thank Firebug and error in the Live.com site for this discovery.

This property allows to apply two kinds of “display” for the same element, in addition there is an equivalent for FireFox as well, namely “display:-moz-inline-box“.

Example :

#content div.left{
	width:180px;
	display:-moz-inline-box;
	display:inline-block;
}
/* Hack for IE */
* html #content div.left{
	display:inline;
}

Another advantages :
Consideration of the property “vertical-align“.
Ability to leave free the height of the element, unlike “float”.

See layout demo

See “float:left” vs “display:block-inline” fight

Are you ready to kill FLOAT ??

Comments (3)

Zouhir BahijOctober 31st, 2009 at 2:57 am

Nice :P

Zouhir BahijOctober 31st, 2009 at 2:57 am

Euh… Not yet ready to kill float!

Sari KaunistoMay 10th, 2011 at 1:43 pm

Thank you for a wonderful post. I enjoyed it.

Leave a comment

Your comment