【问题标题】:Adding more than margin of 5 in bootstrap在引导程序中添加超过 5 的边距
【发布时间】:2020-11-25 23:40:30
【问题描述】:

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

【问题讨论】:

  • m-8 不可用,如果你想要m-8 那么你需要制作类,或者内联css,比如margin : 6rem;

标签: bootstrap-4 padding margin


【解决方案1】:

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

// 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.scss 中找到与您相关的任何内容,您都可以覆盖。

更多详情请参阅此答案:https://stackoverflow.com/a/46125059/3584353

关于在此处覆盖引导变量:https://getbootstrap.com/docs/4.0/getting-started/theming/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-22
    • 2016-08-22
    • 1970-01-01
    • 2016-02-01
    • 2018-11-30
    • 2019-01-05
    相关资源
    最近更新 更多