本文介绍了css 不同系列的不同字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的 CSS 声明:

I have a CSS declaration like this:

font-family: font1, font2, font3;

其中 font1 是嵌入的 eot/ttf 字体,但问题是这种字体比其他字体小,所以我想为这种字体 (font1) 设置不同的字体大小 (1.8em).所有其他字体(font2、font3)保持不变.

where font1 is an embedded eot/ttf font, but the problem is that this font is smaller than the other fonts so I want to have a different font-size (1.8em) for this font (font1). All other fonts (font2, font3) stay untouched.

问题是,我无法验证用户的浏览器是使用 font1、font2 还是 font3.是否有任何 css 声明允许不同系列的不同字体大小?

The problem is, that I cannot verify if the user's browser uses font1, font2 or font3. Is there any css declaration which allows different font-sizes for different families?

谢谢.

推荐答案

一种方法可以做到这一点,但目前它的支持非常糟糕.您正在寻找的 CSS 属性是 font-size-adjust - 一个专门为解决此问题而引入的新 CSS3 属性.规范说:

There is a way to do this, but it's as of now very badly supported. The CSS property you are looking for is font-size-adjust - a new CSS3 property introduced specifically to address this problem. The specification says:

在字体回退的情况下发生,后备字体可能不会共享与所需的纵横比相同字体系列,因此会出现较少可读.字体大小调整财产是保护财产的一种方式字体回退时文本的可读性发生.它通过调整字体大小,以便 x 高度是无论使用什么字体,都是一样的.

但是,它目前仅在 Firefox 中受支持,因此您可能需要寻找替代方案.

However, it is only supported in Firefox as of now, so you might want to look for alternatives.

有关如何使用它的示例,请参阅:

For examples of how to use it, see:

http://webdesignernotebook.com/css/the-little-known-font-size-adjust-css3-property/
https://developer.mozilla.org/en/CSS/font-size-adjust
http://www.fonttester.com/help/css_property/font-size-adjust.html
http://www.w3.org/TR/css3-fonts/#relative-sizing-the-font-size-adjust-pro

这篇关于css 不同系列的不同字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 12:45
查看更多