【发布时间】:2020-11-25 23:40:30
【问题描述】:
在 bootstrap 中,我们可以添加 0-5 的边距,但我想使用 bootstrap 添加更多边距, 我尝试了以下 m-8 但它不起作用
【问题讨论】:
-
m-8不可用,如果你想要m-8那么你需要制作类,或者内联css,比如margin : 6rem;
标签: bootstrap-4 padding margin
在 bootstrap 中,我们可以添加 0-5 的边距,但我想使用 bootstrap 添加更多边距, 我尝试了以下 m-8 但它不起作用
【问题讨论】:
m-8 不可用,如果你想要m-8 那么你需要制作类,或者内联css,比如margin : 6rem;
标签: bootstrap-4 padding margin
您可以将新的间隔定义添加到 $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/
【讨论】: