Equivalent of div display inline-block for IE8, IE7 and older browsers

血红的双手。 提交于 2019-12-03 07:18:10

Here is a good resource that covers this topic: http://foohack.com/2007/11/cross-browser-support-for-inline-block-styling/

Basically IE has a trigger called "hasLayout". Triggering this will allow you to use display:inline-block on a block level element (by default IE only allows inline-block on native inline elements).

Additionally older version of Fire Fox didn't support inline-block either, but had an "inline-stack" value (moz-inline-stack).

Here is, to my knowledge, the best way to get a cross-browser display:inline-block:

display:-moz-inline-stack;
display:inline-block;
zoom:1;
*display:inline;

As given here:

IE supports inline-block, but only for elements that are natively inline. So, if you really want to use inline-block, you’re restricted to spans and strongs and ems...

Yes, it is not logical, because normally it doesn't matter if you use div or span... but remember - this is IE :)

So just change <div> to <span> and that's it!

Web Designer cum Promoter

use this code

*display: inline;
*vertical-align: middle;
GeniusJRS
  display: inline-block; 
  *zoom: 1; 
  *display: inline;

you can add inline-block for other browser but for IE you can add style with *. it only works in ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!