【问题标题】:What is the meaning of $spacer in bootstrap?$spacer 在引导程序中的含义是什么?
【发布时间】:2020-11-15 19:20:06
【问题描述】:

我是新手。我在 bootstrap 上找到了这个文档:

https://getbootstrap.com/docs/4.3/utilities/spacing/

这里写道,当我们编写例如 mt-1 时,这意味着:

1 - (by default) for classes that set the margin or padding to $spacer * .25

在这种情况下 $spacer * .25 意味着什么?

【问题讨论】:

    标签: bootstrap-4 sass


    【解决方案1】:

    $spacer 是一个 SASS 变量。默认值为1rem。因此 mt-1 是margin-top:.25rem;

    6 个间距单位 (0-5) 中的每一个的值都来自 $spacers SASS 映射变量...

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

    结果...

    mt-1 = .25rem
    mt-2 = .5rem
    mt-3 = 1rem
    mt-4 = 1.5rem
    mt-5 = 3rem
    

    相关:How do I use the Spacing Utility Classes on Bootstrap 4

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-29
      • 2017-06-21
      • 1970-01-01
      • 1970-01-01
      • 2017-03-15
      • 2011-03-23
      • 2016-10-23
      相关资源
      最近更新 更多