Html 像 my-2、my-lg-0、mr-sm-2 这样的 css 类在 bootstrap 4 中做什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50750931/
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-29 15:42:34  来源:igfitidea点击:

what do css classes like my-2, my-lg-0, mr-sm-2 do in bootstrap 4?

htmlcsstwitter-bootstrapbootstrap-4navbar

提问by skyleguy

I have looked at other questions and the bootstrap documentation and cant seem to find out what these classes do to elements. Any help is appreciated! Im just trying to make my search bar be 1/4th the size on a large viewport, 1/3 the size on a medium viewport, and 100% the size on a small viewport!

我查看了其他问题和引导程序文档,但似乎无法找出这些类对元素的作用。任何帮助表示赞赏!我只是想让我的搜索栏是大视口的 1/4,中等视口的 1/3,小视口的 100%!

回答by dippas

Those are bootstrap spacing utilities classes :

这些是引导间距实用程序类:

mr-sm-2:

mr-sm-2

r - for classes that set margin-rightor padding-right

r - 对于设置margin-rightpadding-right

my-2, my-lg-0:

my-2my-lg-0

y - for classes that set both *-topand *-bottom

y - 对于同时设置*-top和的类*-bottom

the m

m

m - for classes that set margin

m - 对于设置边距的类

you can see the notation from boostrap spacing here

你可以在这里看到 boostrap 间距的符号



smand lgare utilities classes that everyone who uses bootstrap are use to see it:

sm并且lg是每个使用 bootstrap 的人都会用来查看它的实用程序类:

sm- small

sm- 小的

lg- large

lg- 大的