CSS Bootstrap 4 中的 class="mb-0" 是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41574776/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 12:20:11  来源:igfitidea点击:

What is class="mb-0" in Bootstrap 4?

csstwitter-bootstrapbootstrap-4twitter-bootstrap-4

提问by Phillip Senn

The latest documentionhas:

最新的机制的文档有:

<p class="mb-0">Lorem ipsum</p>

Q: What is mb-0?

问:mb-0 是什么?

回答by Akash Preet

Bootstrap has a wide range of responsive margin and padding utility classes. They work for all breakpoints:

Bootstrap 具有广泛的响应边距和填充实用程序类。它们适用于所有断点:

xs(<=576px), sm(>=576px), md(>=768px), lg(>=992px) or xl(>=1200px))

xs(<=576px)、sm(>=576px)、md(>=768px)、lg(>=992px) 或xl(>=1200px))

The classes are used in the format:

这些类的使用格式如下:

{property}{sides}-{size}for xs & {property}{sides}-{breakpoint}-{size}for sm, md, lg, and xl.

{property}{sides}-{size}用于 xs & {property}{sides}-{breakpoint}-{size}用于 sm、md、lg 和 xl。

m- sets margin

m- 设置边距

p- sets padding

p- 设置填充



t- sets margin-top or padding-top

t- 设置 margin-top 或 padding-top

b- sets margin-bottom or padding-bottom

b- 设置 margin-bottom 或 padding-bottom

l- sets margin-left or padding-left

l- 设置 margin-left 或 padding-left

r- sets margin-right or padding-right

r- 设置 margin-right 或 padding-right

x- sets both padding-left and padding-right or margin-left and margin-right

x- 设置 padding-left 和 padding-right 或 margin-left 和 margin-right

y- sets both padding-top and padding-bottom or margin-top and margin-bottom

y- 设置 padding-top 和 padding-bottom 或 margin-top 和 margin-bottom

blank- sets a margin or padding on all 4 sides of the element

空白- 在元素的所有 4 个边上设置边距或填充



0- sets marginor paddingto 0

0- 将边距填充设置为 0

1- sets marginor paddingto .25rem (4px if font-size is 16px)

1- 将边距填充设置为 .25rem(如果字体大小为 16px,则为 4px)

2- sets marginor paddingto .5rem (8px if font-size is 16px)

2- 将边距填充设置为 .5rem(如果字体大小为 16px,则为 8px)

3- sets marginor paddingto 1rem (16px if font-size is 16px)

3- 将边距填充设置为 1rem(如果字体大小为 16px,则为 16px)

4- sets marginor paddingto 1.5rem (24px if font-size is 16px)

4- 将边距填充设置为 1.5rem(如果字体大小为 16 像素,则为 24 像素)

5- sets marginor paddingto 3rem (48px if font-size is 16px)

5- 将边距填充设置为 3rem(如果字体大小为 16 像素,则为 48 像素)

auto- sets margin to auto

auto- 将边距设置为自动

Bootstrap 4.3 Documentation

Bootstrap 4.3 文档

Read more in w3schools

在 w3schools 中阅读更多内容

回答by Zim

It is used to create a bottom margin of 0(margin-bottom:0). You can see more of the new spacing utility classes here: https://getbootstrap.com/docs/4.0/utilities/spacing/

它用于创建0( margin-bottom:0)的底部边距。您可以在此处查看更多新的间距实用程序类:https: //getbootstrap.com/docs/4.0/utilities/spacing/

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

相关:如何在 Bootstrap 4 上使用间距实用程序类

回答by Talha F.

m- for classes that set margin, like this :

m- 对于设置边距的类,如下所示:

  • mt- for classes that set margin-top
  • mb- for classes that set margin-bottom
  • ml- for classes that set margin-left
  • mr- for classes that set margin-right
  • mx- for classes that set both margin-leftand margin-right
  • my- for classes that set both margin-topand margin-bottom
  • mt- 对于设置的类 margin-top
  • mb- 对于设置的类 margin-bottom
  • ml- 对于设置的类 margin-left
  • mr- 对于设置的类 margin-right
  • mx- 对于同时设置margin-left和的类margin-right
  • my- 对于同时设置margin-top和的类margin-bottom

Where size is one of margin :

其中 size 是 margin 之一:

  • 0- for classes that eliminate the margin by setting it to 0, like mt-0
  • 1- (by default) for classes that set the margin to $spacer * .25, like mt-1
  • 2- (by default) for classes that set the margin to $spacer * .5, like mt-2
  • 3- (by default) for classes that set the margin to $spacer, like mt-3
  • 4- (by default) for classes that set the margin to $spacer * 1.5, like mt-4
  • 5- (by default) for classes that set the margin to $spacer * 3, like mt-5
  • auto- for classes that set the margin to auto, like mx-auto
  • 0- 对于通过将边距设置为 0 来消除边距的类,例如 mt-0
  • 1-(默认情况下)对于将边距设置为 $spacer * .25 的类,例如 mt-1
  • 2-(默认情况下)对于将边距设置为 $spacer * .5 的类,例如 mt-2
  • 3-(默认情况下)对于将边距设置为 $spacer 的类,例如 mt-3
  • 4-(默认情况下)对于将边距设置为 $spacer * 1.5 的类,例如 mt-4
  • 5-(默认情况下)对于将边距设置为 $spacer * 3 的类,例如 mt-5
  • auto- 对于将边距设置为自动的类,例如 mx-auto

回答by Nakkeeran 8797

m - sets margin

m - 设置边距

p - sets padding

p - 设置填充

t - sets margin-top or padding-top

t - 设置 margin-top 或 padding-top

b - sets margin-bottom or padding-bottom

b - 设置 margin-bottom 或 padding-bottom

l - sets margin-left or padding-left

l - 设置 margin-left 或 padding-left

r - sets margin-right or padding-right

r - 设置 margin-right 或 padding-right

x - sets both padding-left and padding-right or margin-left and margin-right

x - 设置 padding-left 和 padding-right 或 margin-left 和 margin-right

y - sets both padding-top and padding-bottom or margin-top and margin-bottom

y - 设置 padding-top 和 padding-bottom 或 margin-top 和 margin-bottom

blank - sets a margin or padding on all 4 sides of the element

空白 - 在元素的所有 4 个边上设置边距或填充

0 - sets margin or padding to 0

0 - 将边距或填充设置为 0

1 - sets margin or padding to .25rem (4px if font-size is 16px)

1 - 将边距或填充设置为 .25rem(如果字体大小为 16px,则为 4px)

2 - sets margin or padding to .5rem (8px if font-size is 16px)

2 - 将边距或填充设置为 .5rem(如果字体大小为 16px,则为 8px)

3 - sets margin or padding to 1rem (16px if font-size is 16px)

3 - 将边距或填充设置为 1rem(如果字体大小为 16px,则为 16px)

4 - sets margin or padding to 1.5rem (24px if font-size is 16px)

4 - 将边距或填充设置为 1.5rem(如果字体大小为 16 像素,则为 24 像素)

5 - sets margin or padding to 3rem (48px if font-size is 16px)

5 - 将边距或填充设置为 3rem(如果字体大小为 16 像素,则为 48 像素)

auto - sets margin to auto

auto - 将边距设置为自动