Does bootstrap have builtin padding and margin classes?

后端 未结 9 2320
庸人自扰
庸人自扰 2020-12-25 09:57

Does Bootstrap have built-in padding and margin classes like pad-10, mar-left-10 or I have to add my own custom classes? For example, similar to th

9条回答
  •  自闭症患者
    2020-12-25 10:35

    Bootstrap 4 has a new notation for margin and padding classes. Refer to Bootstrap 4.0 Documentation - Spacing.

    From the documentation:

    Notation

    Spacing utilities that apply to all breakpoints, from xs to xl, have no breakpoint abbreviation in them. This is because those classes are applied from min-width: 0 and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.

    The classes are named using the format {property}{sides}-{size} for xs and {property}{sides}-{breakpoint}-{size} for sm, md, lg, and xl.

    Examples

    .mt-0 { margin-top: 0 !important; }

    .p-3 { padding: $spacer !important; }

提交回复
热议问题