IE 中的文本阴影,替代方案

发布于 2024-08-11 05:54:35 字数 300 浏览 6 评论 0原文

我需要在 IE 中为内联长段落文本提供文本阴影。我理解渐进增强,但情况有所不同。我确实需要文本阴影,这不是设计问题,而是我的应用程序功能的核心问题。

无论如何,IE 不支持 CSS text-shadow。有哪些替代方案?我知道某些字体的轮廓可以产生与文本阴影类似的效果,但 IE 是否支持网络不安全字体?

动态图像替换怎么样?这是一个可行的策略吗?考虑到文本的长度,我想可能不会。

有人有什么建议吗?我也考虑过强制使用谷歌浏览器框架,但如果没有其他可行的策略,这就是最后的手段。

谢谢。

I have a need for text-shadow for inline, long, paragraph text in IE. I understand progressive enhancement, but the situation is different. I do absolutely need text-shadow, it's not a design issue, but a matter central to the function of my app.

In any case, IE does not support CSS text-shadow. What are some alternatives? I know that some fonts have outlines that creates a similar effect as text-shadows, but does IE support web-unsafe fonts?

What about dynamic image replacement? Is that a viable tactic? I'm thinking probably not, considering the length of the text.

Does anyone have any suggestions? I've also considered forcing google chrome frame, but that's sort of a last resort thing if there are no other viable strategies.

Thanks.

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

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

发布评论

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

评论(3

土豪我们做朋友吧 2024-08-18 05:54:35

我认为你应该使用 true type font(.ttf) 字体并将其转换为 .eot。然后通过 java 脚本在 html 中引用它,如下所示:

<style type="text/css">
@font-face {
 font-family: MyCustomFont;
 font-size:10.0pt;
 src: url("fontname_free.eot");/* EOT file for IE */
}
@font-face {
 font-family: MyCustomFont;
 font-size:10.0pt;
 src: url("fontname_free.ttf") format("truetype");/* TTF file for CSS3 browsers */
}

然后在实际的 html 中,在 style 属性中引用字体,如下所示:

您可以在此处将 .ttf 转换为 .eot,并找到有关其工作原理的进一步说明 http:// www.kirsle.net/wizards/ttf2eot.cgi

I think you should use a true type font(.ttf) font and convert it to .eot. Then referance it in your html via java script likes this:

<style type="text/css">
@font-face {
 font-family: MyCustomFont;
 font-size:10.0pt;
 src: url("fontname_free.eot");/* EOT file for IE */
}
@font-face {
 font-family: MyCustomFont;
 font-size:10.0pt;
 src: url("fontname_free.ttf") format("truetype");/* TTF file for CSS3 browsers */
}

Then in your actual html you make reference to the font in the style attribute like this:

You can convert from .ttf to .eot here and find further explaination on how it workd http://www.kirsle.net/wizards/ttf2eot.cgi

梦行七里 2024-08-18 05:54:35

我认为,就你的核心需求而言,Flash是你最好的选择。我不确定 SIFR 是否支持阴影,但这值得研究。

与强制 Chrome 框架相比,这对用户来说无疑是更便宜的负担。

编辑:

看起来 SIFR 在这方面非常灵活:

http://fortysevenmedia.com/blog/archives /sifr_3_hard_drop_shadows/

更有希望,除非我弄错了,否则看起来 IE 可能支持它:

http://msdn.microsoft.com/en-us/library/ms533086%28VS.85%29.aspx

所以:

.className {
    filter:progid:DXImageTransform.Microsoft.Shadow(color=#0000FF,direction=45);
}

I think that here, with your core requirements, Flash is your best best. I'm not sure if SIFR supports shadow, but that's worth looking into.

It's certainly a cheaper burden on your users than forcing Chrome frame.

EDIT:

Looks like SIFR is quite flexible on this front:

http://fortysevenmedia.com/blog/archives/sifr_3_hard_drop_shadows/

Even more promising, unless I'm mistaken, it looks like it may be supported in IE:

http://msdn.microsoft.com/en-us/library/ms533086%28VS.85%29.aspx

so:

.className {
    filter:progid:DXImageTransform.Microsoft.Shadow(color=#0000FF,direction=45);
}
天邊彩虹 2024-08-18 05:54:35

我刚刚在 IE 中将其用于文本阴影:

p { zoom: 1; background-color: *Your background colour*; -ms-filter: "progid:DXImageTransform.Microsoft.Chroma(Color=*Your background colour*) progid:DXImageTransform.Microsoft.DropShadow(Color=#000, OffX=1, OffY=1)";  filter: progid:DXImageTransform.Microsoft.Chroma(Color=*Your background colour*) progid:DXImageTransform.Microsoft.DropShadow(OffX=1, OffY=1, Color=#000);
}

我唯一关心的是,如果用户更改了 PC 上的文本渲染,现在它会变得非常漂亮。如果我不将文本加粗,我的效果还可以,但一旦我这样做,它就会变得块状。

我可能只是在 IE 中留下文本阴影,但多么 S**!那是……哈哈

I have just used this for text-shadow in IE:

p { zoom: 1; background-color: *Your background colour*; -ms-filter: "progid:DXImageTransform.Microsoft.Chroma(Color=*Your background colour*) progid:DXImageTransform.Microsoft.DropShadow(Color=#000, OffX=1, OffY=1)";  filter: progid:DXImageTransform.Microsoft.Chroma(Color=*Your background colour*) progid:DXImageTransform.Microsoft.DropShadow(OffX=1, OffY=1, Color=#000);
}

My only concern with this is that if the user has changed their text rendering on their PC it will now be so pretty. Mine has turned out okay if I don't bold the text, but as soon as I do it goes blocky.

I may just leave the text shadow in IE but how S**! is that... lol

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