文本阴影:IE8

发布于 2024-11-02 19:07:55 字数 923 浏览 2 评论 0 原文

好吧,所以我正在尝试跨各种浏览器实现 text-shadow 。我的 IE6、IE7、FF、Chrome 和 Opera 都可以正常工作...但 IE8 不会显示任何阴影,除非它处于“兼容性视图”中。

我通过搜索/谷歌查看了许多“解决方案”,但阴影仍然只出现在“兼容性视图”中。

关于如何在不改变模式的情况下让它显示的任何想法?

注意:使用 HTML5 Boilerplate 和 Modernizr。

编辑:补充说我正在使用 Modernizr,并且我在测试器中单击了错误的按钮。这在 IE9 中也不起作用,但我不认为它是相关的。

CSS:

#links li a {
font-size: 24px;
text-shadow: 0 3px 3px #102530, 0 3px 3px #102530;
/* For IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=90, Color='#102530')";
/* For IE 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=90, Color='#102530');
filter:DropShadow(Color=#102530, OffX=0, OffY=3);
zoom: 1;
}

HTML

<ul id="links">
    <li><a href="#"/>Text</a></li>
</ul>

Alright, so I'm trying to implement text-shadow across various browsers. I have IE6, IE7, FF, Chrome, and Opera all working... but IE8 wont' show any shadows unless it is in 'Compatibility View'.

I've looked at a number of 'solutions' via search / Google, but the shadow is still only appearing in 'Compatibility View'.

Any ideas on how to get it to show up without having to change modes?

Note: Using HTML5 Boilerplate and Modernizr.

edit: Added that I'm using Modernizr, and I clicked the wrong button in my tester. This isn't working in IE9 either, but I don't think it is related.

CSS:

#links li a {
font-size: 24px;
text-shadow: 0 3px 3px #102530, 0 3px 3px #102530;
/* For IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=90, Color='#102530')";
/* For IE 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=90, Color='#102530');
filter:DropShadow(Color=#102530, OffX=0, OffY=3);
zoom: 1;
}

HTML

<ul id="links">
    <li><a href="#"/>Text</a></li>
</ul>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

余厌 2024-11-09 19:07:55

我尝试了 Modernizer (也使用 heygrady 的填充)。我尝试了 cssSandpaper。我尝试了CSS3PIE。但它们都没有在 Internet Explorer 8 中向我显示文本阴影(CSS3PIE 不具有 text-shadow 功能)。我还尝试了双标记方法。但事实并非如此。

然后我找到了 Whykiki 的博文并简单地添加了 filter: dropshadow(color=#000000, offx=2, offy=2);display: block; 组合。就是这样。有些人可能会尝试使用 zoom: 1; 而不是 display: block; 来激活它。 filter:glow(color=#000000,strength=2); 也有效。正如您将看到的,MS dropshadow 不带有模糊。我可以忍受这一点。

h1 {
  color: #fce934;
  text-shadow: 2px 2px 2px #000000;
  -moz-text-shadow: 2px 2px 2px #000000;
  -webkit-text-shadow: 2px 2px 2px #000000;
  filter: dropshadow(color=#000000, offx=2, offy=2);
  display: block; /* that's the important part */
}

I tried Modernizer (also with heygrady's polyfill). I tried cssSandpaper. I tried CSS3PIE. But none of them displayed me a text-shadow in Internet Explorer 8 (CSS3PIE doesn't feature text-shadow). I also tried the double-markup method. But that really can't be it.

And then I found Whykiki's blog post and simply added filter: dropshadow(color=#000000, offx=2, offy=2); in combination with display: block;. And that's it. Some of you might try zoom: 1; instead of display: block; to activate it. filter: glow(color=#000000,strength=2); works, too. As you will see, the MS dropshadow doesn't come with blur. I can live with that.

h1 {
  color: #fce934;
  text-shadow: 2px 2px 2px #000000;
  -moz-text-shadow: 2px 2px 2px #000000;
  -webkit-text-shadow: 2px 2px 2px #000000;
  filter: dropshadow(color=#000000, offx=2, offy=2);
  display: block; /* that's the important part */
}
猫九 2024-11-09 19:07:55

网站不一定在每个浏览器中看起来都一样。另外 MS 过滤器很垃圾。
我建议使用 Modernizer 并为 IE8 应用不同的解决方案。

它会让你免于头痛:)

A website must not necessarily look the same in every browser. Plus MS filters are crap.
I would recommend to use Modernizer an apply a different solution for IE8.

It will save you from headaches :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文