We can use CSS Sprites, but doesn't that require all the images be made into block or display: block elements?
I'd like to use CSS Sprites, but I haven't used it in massive scale before, and seems like when all the images are being displayed using CSS Spirites (image as background), th开发者_高级运维en it must be inside a div
or span
with display: block
so that it can have a width and height?
If so, then isn't it messy that, before, as an <img>
, it can flow as an inline element naturally, but now, it has to be floated
.
It might be able to be shown as inline-block
, but I think it is not well supported by all browsers?
I use this fix for inline-block when spiriting (although I ignore the vendor style for Firefox as modern FF plays nice).
FTA:
display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:inline;
Note that IE is generally fine as long as the element hasLayout.
精彩评论