我想在我的网站上使用谷歌的Roboto字体,我正在遵循这个教程:
http://www.maketecheasier.com/use-google-roboto-font-everywhere/2012/03/15
我下载了一个文件夹结构如下所示的文件:
现在我有三个问题:
我有css在我的media/css/main.css url。我需要把文件夹放在哪里呢?
我需要提取所有的eot,svg等从所有子文件夹,并放在字体文件夹?
我需要创建css文件fonts.css和包括在我的基本模板文件?
他的例子是这样的
@font-face {
font-family: 'Roboto';
src: url('Roboto-ThinItalic-webfont.eot');
src: url('Roboto-ThinItalic-webfont.eot?#iefix') format('embedded-opentype'),
url('Roboto-ThinItalic-webfont.woff') format('woff'),
url('Roboto-ThinItalic-webfont.ttf') format('truetype'),
url('Roboto-ThinItalic-webfont.svg#RobotoThinItalic') format('svg'); (under the Apache Software License).
font-weight: 200;
font-style: italic;
}
我的url应该是什么样的,如果我想有dir结构像:
/media/fonts/roboto
老帖子了,我知道。
这也可以使用CSS @import url:
@import url(http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900italic,900);
html, body, html * {
font-family: 'Roboto', sans-serif;
}
很容易
你下载的每个文件夹都有不同的roboto字体,这意味着它们是不同的字体
操作:roboto_regular_macroman
使用它们中的任何一个:
1-解压文件夹的字体你想使用
2-上传到CSS文件附近
3-现在包括在CSS文件
示例:包含名为"roboto_regular_macroman"的字体:
@font-face {
font-family: 'Roboto';
src: url('roboto_regular_macroman/Roboto-Regular-webfont.eot');
src: url('roboto_regular_macroman/Roboto-Regular-webfont.eot?#iefix') format('embedded-opentype'),
url('roboto_regular_macroman/Roboto-Regular-webfont.woff') format('woff'),
url('roboto_regular_macroman/Roboto-Regular-webfont.ttf') format('truetype'),
url('roboto_regular_macroman/Roboto-Regular-webfont.svg#RobotoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
注意文件的路径,这里我上传了一个名为“roboto_regular_macroman”的文件夹,与CSS所在的文件夹相同
那么你现在只需输入font-family: 'Roboto'就可以使用字体了;