【发布时间】:2013-06-14 12:01:54
【问题描述】:
我正在我的网站中实现名为 Roboto 的谷歌字体。
我需要两种类型:bold 和 regular。
所以我检查了这两种类型并按下了下载按钮:
但是在下载的 rar 文件中我得到了所有的字体样式(还有我没有选择的):
无论如何我想测试 常规 字体:(字体现在在我的网站中,而不是从谷歌加载)。
(我使用字体转换器 (http://www.font2web.com/) 获得了其他扩展类型(eot、woff、svg))
所以我做到了:
<style type="text/css">
@font-face {
font-family: 'Roboto';
src: url('/font-face/Regular/Roboto-Regular.eot'); /* IE9 Compat Modes */
src: url('/font-face/Regular/Roboto-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/font-face/Regular/Roboto-Regular.woff') format('woff'), /* Modern Browsers */
url('/font-face/Regular/Roboto-Regular.ttf') format('truetype'), /* Safari, Android, iOS */
url('/font-face/Regular/Roboto-Regularo.svg#svgFontName') format('svg'); /* Legacy iOS */
}
body { font-family: 'Roboto', sans-serif; }
</style>
问题:
假设我想将Roboto bold 样式应用于div。
我应该这样做吗:
div {
font-family: 'Roboto', sans-serif;
font-weight:bold
}
或者我应该这样做(重新开始......)
@font-face {
font-family: 'Roboto-bold';
src: url('/font-face/Regular/Roboto-bold.eot'); /* IE9 Compat Modes */
...
}
然后
div { font-family: 'Roboto-bold', sans-serif; }
【问题讨论】:
标签: html css fonts cross-browser