twitter-bootstrap 自定义引导按钮字体
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32907916/
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
Customize bootstrap button font
提问by Boris Burkov
I'm using sass-version of Bootstrap and want to customize the buttons' font, so that it differs from the system font.
我正在使用 Bootstrap 的 sass 版本并希望自定义按钮的字体,以便它与系统字体不同。
I don't see any sass/less variables that would modify the font-family of my buttons: http://getbootstrap.com/customize/#buttons
我没有看到任何会修改我的按钮字体系列的 sass/less 变量:http: //getbootstrap.com/customize/#buttons
So, how do I achieve that ?
那么,我该如何实现呢?
回答by Gareth
The font-familyof button elements is inherited from the @font-family-sans-serifvariable. The variable as standard is "Helvetica Neue", Helvetica, Arial, sans-serif. You can find the variable here.
font-family按钮元素的of 是从@font-family-sans-serif变量继承的。标准变量是"Helvetica Neue", Helvetica, Arial, sans-serif。您可以在此处找到该变量。
You can override it the btnclass in your ccs with something like:
您可以使用以下内容覆盖btnccs 中的类:
.btn {
font-family: SomeFont;
}
I would recommend doing this in your own stylesheet rather than changing the bootstrap one though.
我建议在您自己的样式表中执行此操作,而不是更改引导程序。
回答by li bing zhao
You can create another class to override the btn class
您可以创建另一个类来覆盖 btn 类
.yourownclass{
font-family: "Arial Bold", Gadget, sans-serif;
font-style: normal;
font-size: 15px ! important; //to make fontsize bigger
}
your HTML should be look like
你的 HTML 应该看起来像
<input type="submit" value="Submit" class="btn btn-primary yourownclass"/>
回答by tophr
In Bootstrap 4, the SASS variables $input-btn-font-familyand $btn-font-familyare available.
在 Bootstrap 4 中,SASS 变量$input-btn-font-family和$btn-font-family可用。

