澄清字体大小和继承。 [英] Clarification on Font Size and Inheritance.
问题描述
大家好,
我只需要确认字体大小及其
继承。举个例子:
body {
font-family:arial;
font-size:95%;
}
p.fineprint {
font-size:75%;
}
p.fineprint中的字体大小是否设置为
正文*中*值的75%?所以在这种情况下,它将是体内95%的75%。我的
实验似乎表明情况就是这样,但我只需要一些
确认。
此外, EM和%如何比较?将字体设置为1em似乎是将
设置为100%,.90em似乎与90%相同。
技术差异是什么?在哪些情况下我应该/我会在
其他地方使用一个吗?
谢谢大家。
Viken K 。
2006年11月1日13:16,Viken Karaguesian写道:
[snip]
body {
font-family:arial;
font-size:95%;
}
< br.> p.fineprint {
font-size:75%;
}
是否将p.fineprint中的字体大小设置为*值的75%
身体*?
假设没有介入的字体大小声明,是的。
[snip]
此外, EM和%如何比较?
它们是成正比的。长度为1em等于font-size属性的计算值
值。此外,如果
字体大小属性的值是1em,则它等于父字体大小的100%。
这在CSS中有解释规格,4.3.2长度。
[snip]
有哪些技术差异?在哪些情况下,我应该/将使用
一个在另一个上面吗?
我建议你总是使用百分比,特别是如果嵌套
字体大小声明。 IE无法正确计算这些。
Mike
-
Michael Winter
在通过电子邮件回复之前用[新闻]作为前缀主题。
2006年1月11日,Viken Karaguesian写道:
body {
font-size:95%;
这是顽皮的!如果你指定BODY的任何字体大小,那么
只需要100%。
-
Netscape 3.04可以做我所做的一切需要,而且它非常可靠。
我为什么要切换? Peter T. Daniels在< news:sci.lang>
有什么理由将font-size设置为100%吗?由于字体大小是继承的
,因此指定正文中网站的字体大小意味着我不需要为< p>重复它。 ,< ul>,< li>,< div>,< td>等
如果我将正文设置为100%但我真的想要我的字体大小为95%,那么
我必须为所有标签指定它,对吧?
Viken K.
>
Hello all,
I just need confirmation on the subject of font size and its
inheritance. Take this example:
body {
font-family: arial;
font-size: 95%;
}
p.fineprint {
font-size: 75%;
}
Is the font size in the p.fineprint set to 75% of the *value in the
body*? So in this case, it would be 75% of the 95% in the body. My
experiments seem to show that that''s the case, but I just need some
confirmation.
Also, how do EM and % compare? Setting the font to 1em seems to be the
same as setting it to 100%, .90em seems the same as 90%. What are the
technical differences? In which cases should/would I use one over the
other?
Thanks everyone.
Viken K.
On 11/01/2006 13:16, Viken Karaguesian wrote:
[snip]
body {
font-family: arial;
font-size: 95%;
}
p.fineprint {
font-size: 75%;
}
Is the font size in the p.fineprint set to 75% of the *value in the
body*?
Assuming that there are no intervening font-size declarations, yes.
[snip]
Also, how do EM and % compare?
They are directly proportional. A length of 1em equals the computed
value of the font-size property. Furthermore, if the value of a
font-size property is 1em, it equals 100% of the parent font size.
This is explained in the CSS Specification, in 4.3.2 Lengths.
[snip]
What are the technical differences? In which cases should/would I use
one over the other?
I would recommend that you always use percentages, especially if nesting
font-size declarations. IE fails to calculate these properly.
Mike
--
Michael Winter
Prefix subject with [News] before replying by e-mail.
On 11 Jan 2006, Viken Karaguesian wrote:
body {
font-size: 95%;
This is naughty! If you specify any font size for BODY, then
take 100% only.
--
Netscape 3.04 does everything I need, and it''s utterly reliable.
Why should I switch? Peter T. Daniels in <news:sci.lang>
Any reason to set the font-size at 100% only? Since the font-size is
inherited, specifying the font-size for a site in the body means I
don''t have to repeat it for <p>, <ul>, <li>, <div>, <td>, etc.
If I set the body to 100% but really want my font-size to be 95%, then
I''d have to specify it for all tags, right?
Viken K.
这篇关于澄清字体大小和继承。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!