如何告诉 sIFR 3 使用不同的粗体、斜体等字体?
我做了一些研究,看来如果您对 sIFR 字体的粗体和斜体变体使用不同的字体(而不是让 Flash 用 B 和 I 按钮来伪造它),那么您就可以将字体包含在 SWF 中,然后编写如下代码:
sIFR.replace(sentinel, {
selector: '.intro p',
css: [
'.sIFR-root { font-family: "Sentinel-Medium"; }',
'strong { font-family: "Sentinel-Bold"; }',
'em { font-family: Sentinel-MediumItalic; }',
'a { color: #0000ff; }',
'a:hover { color: #ff0000; }'
]
});
当我这样做时,Flash 影片显示为空。我猜这只是我的代码的语法问题。有什么建议吗?
更新:我设法让它大部分工作(演示页面)使用以下代码,但我无法使嵌套样式正常工作。例如,我将 em 文本变为红色,将强文本变为蓝色,但如果我尝试将强文本中的 em 文本设置为紫色,则会将所有 em 文本更改为紫色。
sIFR.replace(sentinel, {
selector: '.sifr-test',
css: [
'.sIFR-root { font-family: "Sentinel Medium"; }',
'strong { font-family: "Sentinel Bold"; font-weight: normal; color: #6666ff; }',
'em { font-family: Sentinel Medium Italic; font-style: normal; color: #ff6666; }',
'strong em { font-family: Sentinel Semibold Italic; font-weight: normal; font-style: normal; color: #ff66ff; }',
'a { color: #0000ff; }',
'a:hover { color: #ff0000; }'
]
});
I've done some research, and it seems that if you're using a different font for the bold and italic variants of your sIFR font (as opposed to letting Flash fake it with the B and I buttons) then you have to include the fonts in your SWF, and then write code like this:
sIFR.replace(sentinel, {
selector: '.intro p',
css: [
'.sIFR-root { font-family: "Sentinel-Medium"; }',
'strong { font-family: "Sentinel-Bold"; }',
'em { font-family: Sentinel-MediumItalic; }',
'a { color: #0000ff; }',
'a:hover { color: #ff0000; }'
]
});
When I do that, the flash movie comes up empty. I'm guessing this is just a syntax problem with my code. Any suggestions?
Update: I managed to get this mostly working (demo page) using the following code, but I can't get the nested styles to work properly. For example, I turned em text red and strong text blue -- but then if I try to set em text inside a strong to purple, it changes ALL ems to purple.
sIFR.replace(sentinel, {
selector: '.sifr-test',
css: [
'.sIFR-root { font-family: "Sentinel Medium"; }',
'strong { font-family: "Sentinel Bold"; font-weight: normal; color: #6666ff; }',
'em { font-family: Sentinel Medium Italic; font-style: normal; color: #ff6666; }',
'strong em { font-family: Sentinel Semibold Italic; font-weight: normal; font-style: normal; color: #ff66ff; }',
'a { color: #0000ff; }',
'a:hover { color: #ff0000; }'
]
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定你是否可以做到这一点,Flash 中的 CSS 支持不是很先进。
Not sure if you can do that, the CSS support in Flash isn't very advanced.