简体   繁体   English

CSS Internet Explorer 8 问题中的框阴影

[英]Box Shadow in CSS internet Explorer 8 problem

I have a question about IE8 with css.我对带有 css 的 IE8 有疑问。 I pasted code in my css from msdn我从 msdn 将代码粘贴到我的 css

.shadow {-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')";}

I used the problem code like this我使用了这样的问题代码

<div class="shadow"> <p>Bla Bla</p> </div>

And i have a problem about that.我有一个问题。 I want only DIV has shadow but "Bla Bla" has shadow too.我只想要 DIV 有阴影,但“Bla Bla”也有阴影。

Can anyone suggest a method to fix this issue?任何人都可以提出解决此问题的方法吗?

Thanks...谢谢...

You need to specify a background color for your element:您需要为元素指定背景颜色:

http://jsfiddle.net/UNKAc/14/ http://jsfiddle.net/UNKAc/14/

.shadow {
    background:#fff;
    -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')";
}

Don't quote me on this but: i think this is because IE tries to cast a light that need a solid to drop a shadow.不要引用我的话,但是:我认为这是因为 IE 试图投射需要实体来投射阴影的光。 And since your div is transparent atm the only thing that can cast a shadow is the text itself.而且由于您的 div 是透明的 atm,唯一可以投射阴影的是文本本身。

You could apply background-color: #fff to your div , then you won't be able to see the shadow drawn by the text.您可以将background-color: #fff应用于您的div ,然后您将无法看到文本绘制的阴影。

However, the filter doesn't look as good as box-shadow from CSS3.但是, filter看起来不如 CSS3 box-shadow好。

IE8 does not support box-shadow , but you can emulate it with CSS3 PIE . IE8 不支持box-shadow ,但您可以使用CSS3 PIE来模拟它。

I know this is a couple weeks old, but if you're still tweaking at all you should really look at CSS3 PIE.我知道这已经有几个星期了,但如果你还在调整,你真的应该看看 CSS3 PIE。 One of my friends here at work showed it to me and it's pretty great if you can rely on JS for these types of enhancements for IE.我在这里工作的一位朋友向我展示了它,如果您可以依赖 JS 来对 IE 进行这些类型的增强,那就太好了。

http://css3pie.com/documentation/pie-js/ http://css3pie.com/documentation/pie-js/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM