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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 18:54:26  来源:igfitidea点击:

Source sans pro font in html

csshtmltwitter-bootstrap

提问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 headsection 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

The fonts

字体

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;
}