Bootstrap 4 在引导中添加超过5的边距

Bootstrap 4 在引导中添加超过5的边距,bootstrap-4,padding,margin,Bootstrap 4,Padding,Margin,在bootstrap中,我们可以从0-5添加边距,但我想使用bootstrap添加更多边距, 我尝试了以下m-8,但它不起作用您可以将新的间隔定义添加到$spacers变量,使用您自己的custom.scs,如下所示: // 1. import bootstrap's variables to override them @import "../node_modules/bootstrap/scss/variables"; // 2. your overrides $spa

在bootstrap中,我们可以从0-5添加边距,但我想使用bootstrap添加更多边距,
我尝试了以下m-8,但它不起作用

您可以将新的间隔定义添加到$spacers变量,使用您自己的custom.scs,如下所示:

// 1. import bootstrap's variables to override them
@import "../node_modules/bootstrap/scss/variables";

// 2. your overrides
$spacers: (
  0: 0,
  1: ($spacer * .25),
  2: ($spacer * .5),
  3: $spacer,
  4: ($spacer * 1.5),
  5: ($spacer * 3),
  6: ($spacer * 5)
)

// 3. bootstrap and its default variables
@import "../node_modules/bootstrap/scss/bootstrap";
基本上,您可以在_variables.scs中找到与您相关的任何内容,您可以覆盖这些内容

有关更多详细信息,请参阅此答案:


关于在此处重写引导变量:

您可以向$spacers变量添加新的间隔定义,使用您自己的custom.scs,如下所示:

// 1. import bootstrap's variables to override them
@import "../node_modules/bootstrap/scss/variables";

// 2. your overrides
$spacers: (
  0: 0,
  1: ($spacer * .25),
  2: ($spacer * .5),
  3: $spacer,
  4: ($spacer * 1.5),
  5: ($spacer * 3),
  6: ($spacer * 5)
)

// 3. bootstrap and its default variables
@import "../node_modules/bootstrap/scss/bootstrap";
基本上,您可以在_variables.scs中找到与您相关的任何内容,您可以覆盖这些内容

有关更多详细信息,请参阅此答案:


关于在这里重写引导变量:

m-8
不可用,如果您想要
m-8
,则需要创建类或内联css,如
margin:6rem
m-8
不可用,如果您想要
m-8
则需要创建类或内联css,如
边距:6rem