In IE6/IE7, display: inline-block
only works on elements that are naturally inline (such as span
s).
To make it work on other elements such as div
s, you need this:
#yourElement {
display: inline-block;
*display: inline;
zoom: 1;
}
*display: inline
uses a “safe” CSS hack to apply to only IE7 and lower.
For IE6/7, zoom: 1
provides hasLayout. Having “layout” is a prerequisite for display: inline-block
to always work.
It is possible to apply this workaround while keeping valid CSS, but it’s not really worth thinking about, particularly if you’re already using any vendor prefixed properties.
Read this for more information about display: inline-block
(but forget about -moz-inline-stack
, that was only required for the now ancient Firefox 2).