简体   繁体   English

CSS字母间距和比例字体

[英]CSS letter-spacing and proportional fonts

So I know that my question is pretty technical, but basically I would like to know specifically how the following CSS affects the display of text in <p> tags. 因此,我知道我的问题是非常技术性的,但是基本上我想特别了解以下CSS如何影响<p>标记中的文本显示。

p {
letter-spacing:2px;
font-family:"Georgia";
}

I know that Georgia is a proportional font, that the designer has spent time crafting the spaces between letters to make the font more readable and visually pleasing. 我知道格鲁吉亚是一种比例字体,设计师花了很多时间在字母之间制作空格,以使字体更具可读性和视觉效果。

But my question is how does the letter-spacing property affect this proportionality? 但是我的问题是字母间距属性如何影响这种比例关系? Does this code add two pixels onto the spacing already defined by the type designer, or does it reset that spacing to two pixels? 这段代码是在类型设计者已经定义的间距上添加两个像素,还是将间距重置为两个像素?

This property is additive to what the font would normally use. 此属性是字体通常使用的附加属性。 So, 1px will increase it by a pixel. 因此,1px会将其增加一个像素。 Sitepoint calls it "extra" space (with negative values allowed). Sitepoint称其为“额外”空间(允许使用负值)。

The W3C docs say the same thing: W3C文档说了同样的话:

"This value indicates inter-character space in addition to the default space between characters. Values may be negative..." “此值除指示字符之间的默认间隔外,还指示字符间的间隔。值可能为负...”

It is in addition to any default spacing. 它是除默认间距之外的其他内容。

See: https://developer.mozilla.org/en-US/docs/CSS/letter-spacing 请参阅: https//developer.mozilla.org/en-US/docs/CSS/letter-spacing

From my experiment on Firefox on OSX, using a kerned font (Arial) as opposed to Georgia which does not appear to have kerning on my machine, I can testify that the spacing is in addition to existing spacing, and kerning, and can be either additive, or subtractive. 从我在OSX上的Firefox上进行的实验中,使用了紧缩字体(Arial)而不是佐治亚州,该字体在我的计算机上似乎没有紧缩,我可以证明该间距是现有间距和紧缩的补充,并且可以是加法或减法。

It is also worth mentioning that different browsers and operating systems replace fonts, and handle them slightly differently to each other, making it impossible to predict 100% how any font will be rendered. 还值得一提的是,不同的浏览器和操作系统会替换字体,并且对字体的处理略有不同,因此无法100%预测如何呈现任何字体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM