Internet Explorer - CSS 阴影无处不在
我一直在为这个问题烦恼,除了顶部之外,我想要一个围绕整个元素的简单阴影。我让它在 Firefox 和 Chrome 中正常工作。但是 IE 有这个奇怪的“方向”设置,其他的有 4 个数字来定义阴影。
有人可以帮我定义正确的 CSS,以便除了顶部之外,整个元素周围都会有阴影。
/* For Firefox and Chrome */
-moz-box-shadow: 0px 0px 7px #000;
-webkit-box-shadow: 0px 0px 7px #000;
box-shadow: 0px 0px 7px #000;
/* for IE */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=600, Color='#000000')";
I have been ripping my hair out over this issue, I want a simple shadow that does around the whole element, besides for the top. I got it to work in Firefox and Chrome with no problem. But IE has this weird "direction" setting where as the other as 4 numbers to define the shadow.
Can someone help me define the right CSS so that it will have a shadow around the whole element besides the top.
/* For Firefox and Chrome */
-moz-box-shadow: 0px 0px 7px #000;
-webkit-box-shadow: 0px 0px 7px #000;
box-shadow: 0px 0px 7px #000;
/* for IE */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=600, Color='#000000')";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
阴影滤镜是单向的,方向是 1 到 360 度之间的数字。要生成能够抵消该阴影的盒阴影,您需要使用多个阴影滤镜:
按上/右/下/左排序,改变任何一侧的强度都会改变那个影子的大小。例如,2 5 5 10 将产生垂直向下的阴影,从而产生高度的错觉。
The shadow filter is unidirectional, and direction is a number between 1 and 360 degrees. To generate a box shadow with the ability to offset that shadow, you'll need use multiple shadow filters:
This is sorted top/right/bottom/left, and varying the strength on any one side will alter the size of that shadow. For example, 2 5 5 10 will produce a straight-down drop shadow that gives the illusion of height.
类似于上面的答案(参见下面的注释):
重要:
请记住,IE 中还有一个错误,它会将相同的样式应用于子元素。因此,如果愿意,您可能需要应用“计数器”/“无效器”。
例子:
Similar to Above Answer (See Note Below):
Important:
Keep in mind there's also a bug in IE where it will apply that same style to child elements. So you may need to apply a "counter"/"Nullifier" if you will.
Example:
尝试使用“发光”过滤器:
http://msdn.microsoft.com /en-us/library/ms532995(v=VS.85).aspx
Try the "glow" filter instead:
http://msdn.microsoft.com/en-us/library/ms532995(v=VS.85).aspx
这里有解决方案:
http://www.artlebedev.com/tools/technogrette/html/ ie 中的过滤器/
结合发光和模糊滤镜,看起来效果明显更好,引用上面页面上的代码示例之一:
there are solutions here:
http://www.artlebedev.com/tools/technogrette/html/filters-in-ie/
combining the glow and blur filters which look significantly better, to quote one of the code samples on the page above: