浏览器在尝试呈现自定义字体时遵循的规则是什么?
What is the rule that browsers follow when attempting to render custom fonts?
我有几个关于浏览器如何尝试呈现自定义字体的问题。希望这些问题的答案能帮助我解决我现在遇到的问题。
假设我有一个 @font-face
声明
@font-face {
font-family: 'museo_700regular';
src: url('some-font.eot');
src: url('some-font-iefix.eot') format('embedded-opentype'),
url('some-font.woff') format('woff'),
url('some-font.ttf') format('truetype'),
url('some-font.svg') format('svg');
font-weight: normal;
font-style: normal;
}
浏览器是否尝试 read/render some-font.eot
,如果不起作用,尝试 some-font-iefix.eot
,等等?
如果 CSS 文件之间存在冲突的 @font-face
声明,浏览器会尝试读取最后一个吗?
如果前一个 read/render 编辑正确而第二个无效怎么办:浏览器是否停留在第一个?
Does the browser try to read/render some-font.eot
, and if it doesn't work, tries some-font-iefix.eot
, etc.?
排序。不同的浏览器支持不同类型的字体。浏览器确定它知道如何呈现哪一个,然后下载并使用那个。
if there are conflicting @font-face
declarations between CSS files, does the browsers try to read the last one?
是。 CSS 始终是分层的。如果最下面的声明是将要使用的声明。
What if the previous one was read/rendered properly and the second is invalid: Does the browser stay with the first one?
假设 CSS 在句法上有效, 否 。如果它无效,它不会覆盖之前的声明(因为浏览器不知道如何处理它)。
我有几个关于浏览器如何尝试呈现自定义字体的问题。希望这些问题的答案能帮助我解决我现在遇到的问题。
假设我有一个 @font-face
声明
@font-face {
font-family: 'museo_700regular';
src: url('some-font.eot');
src: url('some-font-iefix.eot') format('embedded-opentype'),
url('some-font.woff') format('woff'),
url('some-font.ttf') format('truetype'),
url('some-font.svg') format('svg');
font-weight: normal;
font-style: normal;
}
浏览器是否尝试 read/render
some-font.eot
,如果不起作用,尝试some-font-iefix.eot
,等等?如果 CSS 文件之间存在冲突的
@font-face
声明,浏览器会尝试读取最后一个吗?如果前一个 read/render 编辑正确而第二个无效怎么办:浏览器是否停留在第一个?
Does the browser try to read/render
some-font.eot
, and if it doesn't work, triessome-font-iefix.eot
, etc.?
排序。不同的浏览器支持不同类型的字体。浏览器确定它知道如何呈现哪一个,然后下载并使用那个。
if there are conflicting
@font-face
declarations between CSS files, does the browsers try to read the last one?
是。 CSS 始终是分层的。如果最下面的声明是将要使用的声明。
What if the previous one was read/rendered properly and the second is invalid: Does the browser stay with the first one?
假设 CSS 在句法上有效, 否 。如果它无效,它不会覆盖之前的声明(因为浏览器不知道如何处理它)。