Friday, July 18, 2008

Inline Block

Elements may appear inline, yet retaining box models of block elements:


/* FF,NS */
html>body .inline-block {
display: -moz-inline-box; /* [FF3]+ */
display: inline-block; /* (FF3)- */
}

/* Safari, Webkit, Opera */
.inline-block {
position: relative;
display: inline-block;
}

/* (IE7)- */
/* to inline does the trick. */
* html .inline-block {
display: inline;
}

/* [IE7]+ */
*:first-child+html .inline-block {
display: inline;
}