CSS 导入和使用 google webfont
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19161854/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Import and use google webfont
提问by Romain
For a project, I have to use many style off a font. Here is the link of the google font
对于一个项目,我必须使用许多样式的字体。这是谷歌字体的链接
Here is my css import
这是我的 css 导入
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,300,400,700);
What I would like to know is how can I define the font-family to display for example the "Open Sans Light 300 Italic"
我想知道的是如何定义字体系列以显示例如“Open Sans Light 300 Italic”
Thanks
谢谢
回答by
CSS
CSS
@import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,300,400,700);
body {
font-family: 'Open Sans', sans-serif;
}
body p {
font-style: italic;
font-weight: 300; /* You specify the number you see next to the fonts to change from light to bold ie you would put 700 etc. etc. */
}
回答by jonsuh
I think this is what you're looking for.
我想这就是你要找的。
body {
font-family: "Open Sans";
font-weight: 300;
font-style: italic;
}
回答by Anon
300/400/700 is font-weight. If you want bold font use
300/400/700 是字体粗细。如果你想要粗体字体使用
font:bold(or 700) 12px/15px "Open Sans", sans-serif
if you want light italic use
如果你想使用浅斜体
font:300 italic 12px/15px "Open Sans", sans-serif