【发布时间】:2016-09-27 11:22:48
【问题描述】:
不知道为什么,但@font-face 已停止在我的一些网站(Blogger 和 Wordpress)上工作。我之前使用 Google Drive 来托管字体如下:
@font-face {font-family: 'Biloxi';
src: url('https://googledrive.com/host/0Bybz--lLp5SvZmc0SGRGOVB4dEE/Biloxi Script-webfont.eot');
src: url('https://googledrive.com/host/0Bybz--lLp5SvZmc0SGRGOVB4dEE/Biloxi Script-webfont.eot') format('embedded-opentype'),
url('https://googledrive.com/host/0Bybz--lLp5SvZmc0SGRGOVB4dEE/Biloxi Script-webfont.woff') format('woff'),
url('https://googledrive.com/host/0Bybz--lLp5SvZmc0SGRGOVB4dEE/Biloxi Script-webfont.ttf') format('truetype'),
url('https://googledrive.com/host/0Bybz--lLp5SvZmc0SGRGOVB4dEE/Biloxi Script-webfont.svg') format('svg');
font-weight: normal;
font-style: normal;}
当它停止工作时,我尝试在我的服务器上托管字体并链接到如下文件中的字体,但即使这样也没有加载我觉得奇怪的字体。
@font-face {
font-family: 'Shorelines Script';
src: url('ShorelinesScriptBold.eot');
src: url('ShorelinesScriptBold.eot?#iefix') format('embedded-opentype'),
url('ShorelinesScriptBold.woff') format('woff'),
url('ShorelinesScriptBold.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
它似乎是零星的,所以字体会加载一分钟,但是你刷新它就不会加载(例如http://hummingbirdgattodesign.blogspot.co.uk/)。问题出现在 Blogger 和 Wordpress 上,似乎出现在 Chrome 和 Firefox 上。
作为一个相对缺乏经验的编码人员,非常感谢任何帮助!
【问题讨论】:
-
第 1 步:删除所有不再支持的字体格式。
woff/woff2用于现代浏览器,eot仅如果你需要 IE8 或更早的支持(你不应该这样做,因为微软终于在大约一年前放弃了 IE8 及更低版本)。其他一切要么是死格式(如.svg)要么是冗余格式(如ttf/otf,它们已经被woff逐字节包装,并且没有正确支持ttf/otf但不支持的浏览器woff)
标签: css wordpress fonts blogger