为什么MS过滤器(dropShadow,glow或shadow)对IE中的<span>标签不起作用?</span>

时间:2012-01-23 21:48:22

标签: css internet-explorer shadow dropshadow css3

我只想将文本阴影应用于Internet Explorer 6-9中的<span>元素。我正在使用以下CSS代码。

.dropShadow { filter: dropshadow(color=#ffff00,offX=5,offY=5); }
.glow       { filter: glow(color=#ff0000); }
.shadow     { filter: shadow(color=#00ff00); }

使用此HTML:

<span class="dropShadow">span with dropShadow</span>
<p class="dropShadow">paragraph dropShadow</p>
<span class="glow">span with glow</span>
<p class="glow">paragraph with glow</p>
<span class="shadow">span with shadow</span>
<p class="shadow">paragraph with shadow</p>

结果是只有<p>元素才会收到 dropShadow glow shadow 样式。但<span>不会应用样式。为什么呢?

There is a live example (jsfiddle). I have used IE9.

1 个答案:

答案 0 :(得分:6)

您可以在{span}中添加display:inline-block

http://jsbin.com/ipiqak/edit#preview