CSS 向 Twitter Bootstrap 添加新的字体系列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19750647/
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
Adding a new font family to Twitter Bootstrap
提问by Norman
How can I add a new font family to twitter bootstrap just the way they do it? They use something called woff. I'm trying to add roboto condensed to the .css file. How can I do it like they do it with the woff thing?
我如何才能按照他们的方式将新字体系列添加到 twitter bootstrap?他们使用一种叫做 woff 的东西。我正在尝试将 Roboto 添加到 .css 文件中。我怎么能像他们用 woff 那样做呢?
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url("//themes.googleusercontent.com/static/fonts/opensans/v6/u-WUoqrET9fUeobQW7jkRT8E0i7KZn-EPnyo3HZu7kw.woff") format('woff');
}
I searched everywhere, but cant find how to do the woff thing.
我到处搜索,但找不到如何做 woff 的事情。
回答by Hello Universe
Create a new CSS file. Call it custom.css
. Link the CSS file inside your CSS tag as external CSS file. There add your @font-face
code as in:
创建一个新的 CSS 文件。叫它custom.css
。将 CSS 标签内的 CSS 文件链接为外部 CSS 文件。添加您的@font-face
代码,如下所示:
@font-face {
font-family: 'OpenSans';
font-style: normal;
font-weight: 400;
src: local('Open Sans'), local('OpenSans'), url("//themes.googleusercontent.com/static/fonts/opensans/v6/u-WUoqrET9fUeobQW7jkRT8E0i7KZn-EPnyo3HZu7kw.woff") format('woff');
}
Your @font-face
code seems to be missing some fonts/file. You can use Font Squirelto convert your font file and generate the corresponding CSS file. Use that block of CSS file.
您的@font-face
代码似乎缺少一些字体/文件。您可以使用Font Squirel来转换您的字体文件并生成相应的 CSS 文件。使用该 CSS 文件块。
And then use OpenSans in your font-family css.
然后在您的字体系列 css 中使用 OpenSans。
I hope it helps
我希望它有帮助