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
What is class="mb-0" in Bootstrap 4?
提问by Phillip Senn
回答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- 将边距设置为自动
回答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
回答by Talha F.
m
- for classes that set margin, like this :
m
- 对于设置边距的类,如下所示:
mt
- for classes that setmargin-top
mb
- for classes that setmargin-bottom
ml
- for classes that setmargin-left
mr
- for classes that setmargin-right
mx
- for classes that set bothmargin-left
andmargin-right
my
- for classes that set bothmargin-top
andmargin-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, likemt-0
1
- (by default) for classes that set the margin to $spacer * .25, likemt-1
2
- (by default) for classes that set the margin to $spacer * .5, likemt-2
3
- (by default) for classes that set the margin to $spacer, likemt-3
4
- (by default) for classes that set the margin to $spacer * 1.5, likemt-4
5
- (by default) for classes that set the margin to $spacer * 3, likemt-5
auto
- for classes that set the margin to auto, likemx-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 - 将边距设置为自动