提问人:Shad 提问时间:10/31/2023 更新时间:10/31/2023 访问量:10
在使用 Bootstrap 4 的间距实用程序时保留较旧的 mixin
Keeping older mixin while utilzing Bootstrap 4's spacing utilities
问:
我有一个几年前的应用程序,它使用 Bootstrap 4 以及自定义 mixin 来间距。mixin.scss 如下:
$sides: (top, left, bottom, right);
@each $prop in $props {
.#{str-slice($prop, 0, 1)}-0 {
#{$prop}: 0 !important;
}
@each $side in $sides {
.#{str-slice($prop, 0, 1)}#{str-slice($side, 0, 1)}-0 {
#{$prop}-#{$side}: 0 !important;
}
}
@for $i from 1 through 16 {
.#{str-slice($prop, 0, 1)}-#{$i*2} {
#{$prop}: #{$i * 2}px !important;
}
@each $side in $sides {
.#{str-slice($prop, 0, 1)}#{str-slice($side, 0, 1)}-#{$i*2} {
#{$prop}-#{$side}: #{$i * 2}px !important;
}
}
.#{str-slice($prop, 0, 1)}x-#{$i*2} {
#{$prop}: 0 #{$i * 2}px !important;
}
.#{str-slice($prop, 0, 1)}y-#{$i*2} {
#{$prop}: #{$i * 2}px 0 !important;
}
}
}
@for $i from 1 through 20 {
.w-#{$i*5} {
width: #{$i * 5%} !important;
}
}
这似乎只影响偶数,这很好。但是我想使用 Bootstrap 4 的间距实用程序,这些实用程序基于数字 1-5(即 for),同时还保留了一些更高的数字可用(我已经找到并在整个应用程序中)。mt-3
margin-top:16px
mt-24
mt-32
我将如何更新当前以基本上忽略设置为 1、2、3、4 或 5 的任何边距/填充,并让 bootstrap 4 处理它?_mixin.scss
答: 暂无答案
评论