Gra*_*der 10 css css3 font-face
根据这篇文章,http://www.standardista.com/css3/font-face-browser-support IE支持,@font-face但我找不到任何有效的自定义字体面为IE工作的网站
此外,如果IE @font-face从早期开始支持自定义字体(IE6),那么为什么人们仍然使用cufon呢?
有任何澄清或例子吗?
Yi *_*ang 13
早期版本的Internet Explorer支持嵌入式OpenType(EOT)文件,然后@font-face在CSS3中进行了形式化.您可以在FontSquirrel或Google的Font API等网站上找到兼容的文件.FontSquirrel的转换工具也应该有帮助.另外值得一读的是fontspring推荐的最新防弹语法,用于为多个浏览器嵌入多个文件.
直到最近才频繁使用的事实是双重的; 首先使用@font-face字体存在法律问题- 版权具体.与仅保留字体形状的cufon不同,@font-face您自己传输实际字体,这具有法律含义.
另一个问题是其他浏览器的支持 - Firefox 3是最后一个不支持@font-face某种方式的现代浏览器,因此在Firefox 3.5于2009 @font-face年中期发布之前仍然不可行.除了浏览器之间的格式支持存在差异外,所以技术的发展很慢.
Internet Explorer 9需要EOT类型字体.TTF字体可用于大多数其他最近的浏览器版本和SVG用于iPhone和iPad等设备.您可以在http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp上阅读有关@ font-face的浏览器支持的更多信息.
Font Squirrel也是创建Web字体文件(包括现有字体文件中的EOT)的绝佳资源.请确保您拥有使用网络上字体的许可.您可以在此处访问免费的Web字体文件生成器:http: //www.fontsquirrel.com/fontface/generator
@ font-face集的典型CSS条目如下所示:
@font-face
{
font-weight: normal;
font-style: normal;
font-family: 'custom-font';
src: url('/some/directory/custom-font.eot');
src: url('/some/directory/custom-font.eot?#iefix') format('embedded-opentype'),
url('/some/directory/custom-font.woff') format('woff'),
url('/some/directory/custom-font.ttf') format('truetype'),
url('/some/directory/custom-font.svg#webfont') format('svg');
}
Run Code Online (Sandbox Code Playgroud)
然后,您可以通过使用css指定"font-family"属性来调用您的字体
.my-class { font-family: "custom-font" }
Run Code Online (Sandbox Code Playgroud)