我正在使用 compass 模块从 sccs 文件生成我的 css 文件。
早些时候我只在 Linux 上工作,当创建 css 文件时,fon-face 属性如下所示:
@font-face {
font-family:"NationalReg";
src: url('../fonts/national-regular.eot');
src: url('../fonts/national-regular.eot?#iefix') format('eot'), url('../fonts/telecomnational-regular.woff') format('woff'), url('../fonts/national-regular.ttf') format('truetype'), url('../fonts/national-regular.svg') format('svg');
}
现在我在 Windows 上工作,生成的 css 文件具有以下结构:
@font-face {
font-family:"NationalReg";
src: url('../fonts/national-regular.eot');
src: url('../fonts/national-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/telecomnational-regular.woff') format('woff'), url('../fonts/national-regular.ttf') format('truetype'), url('../fonts/national-regular.svg') format('svg');
}
注意 format("eot") 和 format("embedded-opentype") 的区别。
我知道这是为 IE8 及以下浏览器添加的。但是如果使用两种不同的格式标签(在 windows/linux 中),它会产生任何问题。
最佳答案
我已经看到使用了这两个值,但我找不到任何记录在案的差异。
Microsoft @font-face documentation说(强调我的):
To specify specific font formats (only for externally referenced font files), use a format hint (format(fontFormat)) where fontFormat is a comma-separated list of format strings that denote supported font formats. Possible fontFormat values are "woff", "truetype", "opentype", and "embedded-opentype". The format hint is optional starting in Internet Explorer 9. (format hints are not supported in Internet Explorer 8 and earlier versions and are ignored.)
由于 .eot 文件格式仅适用于 Microsoft 浏览器,在这种情况下,我会相信他们的话并使用
format('embedded-opentype')
.
关于css - 格式 ('embedded-opentype' ) 和格式 ('eot' 之间的区别),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24601534/