2012-12-11 66 views
7

我正在尝试使用google web字体打开sans bootstrap。渲染打开无谷歌网站字体与引导?

我加载的字体有:

我有一个网站,specific.css是引导后加载。我已经试过:

.body { font-family: 'Open Sans', sans-serif;} 

也:

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

但似乎不管我用什么类选择,字体不渲染和引导字体,而不是继承。我不知道如何调试。

+0

你为什么不自定义Bootstrap? – SLaks

回答

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 
} 
+0

!重要的是对渲染输出没有任何影响。 –

9

前提是你有没有改变引导的核心文件,我想使这更容易对自己和使用他们的“自定义”功能。在放入字体名称后重新下载它,并用新的文件替换现有的引导文件。

你可以在这里定制:

http://getbootstrap.com/customize/

这样做至少可以保证你不会错过的东西......和请,上述(除非你的建议避免使用!important需要真的)。 希望有帮助吗?

+1

只需在自定义页面上的“@SansFontFamily”框中插入“Open Sans”,然后再下载它,并且不要忘记在文档头部包含来自google webfonts api的链接 – Pevara

+1

我正在使用bootstrap CDN中的bootstrap。但我会尝试这种方法。我只是不明白为什么重写的继承字体样式看起来如此困难。 –

+4

这个工作适合你吗?你是否认为接受答案是正确的?这将在未来帮助其他人解决类似的问题。谢谢。 –