我正在尝试在我正在处理的网站中设置几个 sIFR 文本实例的样式,但我不太理解 样式文档。
它说:“当为 .sIFR-root 类指定并给定 px 单位时,这将确定 sIFR 用于渲染 Flash 影片的实际字体大小”,但随后警告您不要这样做,因为这会使文本无法缩放。
然后它说“当为其他选择器指定时,使用%单位使字体大小相对于主字体大小”,但我不知道他们指的是什么“其他选择器”。它说必须在 sifr-config.js 文件中指定样式,但在该文件中我可以看到可以输入自己的 CSS 的唯一位置是 .sIFR-root 类。以下是调用 sIFR 的每个实例的代码:
sIFR.replace(inkburrow, {
selector: '#sidebar h3',
css: '.sIFR-root { 背景颜色: #F7F8F2;颜色:#222222;字体大小:24px; }'
});
(在本例中,特定的字体、颜色等是我正在使用的)。所以我不确定除了 .sIFR-root 类之外他们希望您在哪里放置相对字体大小。将像素以外的任何单位放入 .sIFR-root 类中都不起作用 - 我尝试过。并且在站点的常规样式表中为要替换的选择器(在本例中为#sidebar h3)提供任何类型的字体样式都没有效果 - 也尝试过。
如您所见,目前我正在按照他们警告的方式进行操作:在 .sIFR-root 中设置 px 大小。但如果可能的话,我宁愿能够使用相对大小 - 我只是不知道应该把它放在哪里!
I'm trying to style a couple of instances of sIFR text in a site I'm working on, and I don't quite understand the technique recommended in the styling documentation.
It says that: "When specified for the .sIFR-root class and given a px unit, this determines the actual font size sIFR uses to render the Flash movie", but then warns you off of doing this as it will make the text unscalable.
It then says that "When specified for other selectors, use the % unit to make the font size relative to the main font size," but I don't know what "other selectors" they're referring to there. It says that styling must be specified in the sifr-config.js file, but the only place in that file I can see where you can enter your own CSS is the .sIFR-root class. Here's the code that calls each instance of sIFR:
sIFR.replace(inkburrow, {
selector: '#sidebar h3',
css: '.sIFR-root { background-color: #F7F8F2; color: #222222; font-size: 24px; }'
});
(in this instance, the specific font, colours, etc. are those I'm using). So I'm not sure where other than in the .sIFR-root class they want you to put a relative font-size. Putting any unit other than pixels in the .sIFR-root class doesn't work - I tried it. And giving any kind of font styling to the selector being replaced (in this case #sidebar h3) in the site's regular style sheet has no effect - tried that too.
As you can see, currently I'm doing it the way they warned against: setting a px size in .sIFR-root. But I'd rather be able to use a relative size if possible - I just can't figure out where I'm supposed to put it!
发布评论
评论(2)
确保你的字体大小:100%;在主样式表中的 body { } 样式中。
假设大多数浏览器的默认字体大小为 16px。因此,如果您希望字体为 24px,请将 .sIFR-root CSS 设置为 font-size: 150%;它会将所有 sIFR 文本的相对大小调整为 24px。
如果它仍然不起作用,请使用 Firefox 中的 Firebug 插件查看它,并了解为什么该样式被其他地方的另一种样式覆盖。
Make sure you have font-size: 100%; in your body { } style in the main style sheet.
Assume that most browsers will have a default font size of 16px. So if you want your font to be 24px, set the .sIFR-root CSS to say font-size: 150%; and it will resize all of your sIFR text to 24px with relative size.
If it still doesn't work, take a look at it using the Firebug add-on in Firefox, and see why that style is being overridden by another style somewhere else.
如果您未在
sIFR.replace()
中指定任何字体大小,sIFR 将使用文档中的字体大小。如果您想在 sIFR Flash 影片中混合不同的字体大小而不指定主要字体大小(以像素为单位),则百分比非常有用。
If you don't specify any font size in the
sIFR.replace()
, sIFR will use the font size from the document.The percentages are useful if you want to mix different font sizes within a sIFR Flash movie without specifying the main font size in pixels.