如何在 Bootstrap 中覆盖默认字体权重

Abr*_*ram 4 twitter-bootstrap bootstrap-4

我要导入的字体本身没有 500 的字体粗细(这是 Bootstrap 开箱即用的字体粗细之一)。如何更改默认值。我在这里看了:https : //getbootstrap.com/docs/4.1/getting-started/theming/#variable-defaults

Zim*_*Zim 6

您将使用 SASS 并设置适当的字体变量。500 权重仅用于$headings-font-weight默认情况下。根据您导入的字体中可用的任何权重设置权重。

/* set font variable customizations */
$font-family-base: 'Montserrat', sans-serif; 

$font-weight-light: 300;
$font-weight-normal: 400;
$font-weight-bold: 700; 
$headings-font-weight: 800;

/* remember to import Bootstrap after the changes */ 
@import "bootstrap";
Run Code Online (Sandbox Code Playgroud)

演示:https : //www.codeply.com/go/tjqFpMnjfa


相关:如何使用 SASS 扩展/修改(自定义)Bootstrap 4