使用bootstrap渲染打开google web字体?

Dav*_*son 7 css google-webfonts twitter-bootstrap

我正在尝试使用google web字体打开sans with bootstrap.

我正在加载字体:

我有一个site-specific.css,在bootstrap之后加载.我试过了:

.body { font-family: 'Open Sans', sans-serif;}
Run Code Online (Sandbox Code Playgroud)

并且:

.bootstrap-container *,    
.bootstrap-container body, 
.bootstrap-container td, 
.bootstrap-container tr, 
.bootstrap-container div, 
.bootstrap-container p, 
.bootstrap-container form, 
.bootstrap-container input, 
.bootstrap-container select, 
.bootstrap-container textarea, 
.bootstrap-container font {
font-family: 'Open Sans', sans-serif;
}
Run Code Online (Sandbox Code Playgroud)

但似乎无论我使用什么类选择器,字体都不会渲染,而是继承引导字体.我不知道如何调试这个.

Mic*_*umo 9

如果您没有更改Bootstrap的核心文件,我会让您更轻松地使用它们的"自定义"功能.将字体名称放入后重新下载,并用新的自举文件替换现有的引导程序文件.

你可以在这里自定义它:

http://getbootstrap.com/customize/

这样做至少可以确保你不会错过任何东西......请尽量避免!important按照上面的建议使用(除非你真的需要).希望有帮助吗?

  • 它能为您提供帮助吗?你认为接受答案是否正确?这将有助于将来有类似问题的其他人.谢谢. (4认同)

Mr.*_*ien 4

使用CSS!important

.bootstrap-container *,    
.bootstrap-container body, 
.bootstrap-container td, 
.bootstrap-container tr, 
.bootstrap-container div, 
.bootstrap-container p, 
.bootstrap-container form, 
.bootstrap-container input, 
.bootstrap-container select, 
.bootstrap-container textarea, 
.bootstrap-container font {
font-family: 'Open Sans', sans-serif !important; <-------- Here
}
Run Code Online (Sandbox Code Playgroud)