html 中的源 sans pro 字体
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35203696/
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
Source sans pro font in html
提问by Steve
I would like to use googles "source sans pro" font in the font-family attribute in CSS, in my HTML site. I use Bootstrap as a front end framework.
我想在我的 HTML 站点的 CSS 的 font-family 属性中使用谷歌的“source sans pro”字体。我使用 Bootstrap 作为前端框架。
https://www.google.com/fonts/specimen/Source+Sans+Pro
https://www.google.com/fonts/specimen/Source+Sans+Pro
How can I achieve that? Do I have to include the file into my html site?
我怎样才能做到这一点?我必须将文件包含在我的 html 站点中吗?
Thank you for any help!
感谢您的任何帮助!
回答by Igor Ivancha
Add this string in head
section of your site:
在head
您网站的部分添加此字符串:
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
Then use this font:
然后使用这个字体:
h1 {
font-family: 'Source Sans Pro', sans-serif;
}
回答by Rob
The instructions are given on the link at the top of the page you show. https://www.google.com/fonts#UsePlace:use/Collection:Source+Sans+Pro
说明在您显示的页面顶部的链接中给出。https://www.google.com/fonts#UsePlace:use/Collection:Source+Sans+Pro
You include this in the head of your page:
您将其包含在页面的头部:
https://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
https://fonts.googleapis.com/css?family=Source+Sans+Pro'rel='stylesheet' type='text/css'>
and specify the font family in your CSS.
并在您的 CSS 中指定字体系列。
element {
font-family: "Source Sans Pro"
]
element {
font-family: "Source Sans Pro"
]
回答by C.Schubert
You can select the fonts you want and you get a link: for HTML
你可以选择你想要的字体,你会得到一个链接:对于 HTML
https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200,900italic,900,700italic,700,600italic,600,400italic,300italic,300,200italic' rel='stylesheet' type='text/css'>
https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,200,900italic,900,700italic,700,600italic,600,400italic,300italic,300,200italic'rel='stylesheet' type='text/css'>
paste this link in your
将此链接粘贴到您的
Then use this in your css
然后在你的css中使用它
font-family: 'Source Sans Pro', sans-serif;
so something like this
所以像这样
.class{
font-family: 'Source Sans Pro', sans-serif;
}