twitter-bootstrap `pN` 及其变体在 Bootstrap v4 中代表什么?

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

What does the `p-N` and its variants represent in Bootstrap v4?

csstwitter-bootstrapbootstrap-4twitter-bootstrap-4

提问by Chris

I find the naming in Bootstrap v4 less than intuitive.

我发现 Bootstrap v4 中的命名不太直观。

I know they want to minimise the impact all the classes cluttering up the markup, but I just can't come to a reasonable conclusion. I can guess - but I can't find concrete answers.

我知道他们想尽量减少所有类混淆标记的影响,但我无法得出合理的结论。我可以猜测 - 但我找不到具体的答案。

  • p-1, p-2, p-N: Flexbox related, but what does the pstand for?
  • d-flex: Flexbox related, but what does the dstand for? Perhaps display?
  • mr-auto- Elliots cousin? Guessing margin related - perhaps margin-right-autobut can't confirm in the docs.
  • mt-auto- ?
  • ml-auto- ?
  • p-1, p-2, pN: Flexbox 相关,但代表什么p
  • d-flex: Flexbox 相关,但它d代表什么?也许display
  • mr-auto- Elliot 的堂兄?猜测保证金相关 - 也许margin-right-auto但无法在文档中确认。
  • 山-汽车- ?
  • 毫升自动- ?

回答by Zim

They are the new spacing utilityclasses. I think they're very intuitive:

它们是新的间距实用程序类。我认为它们非常直观:

  • p-*is for padding all sides.
  • m-*is for margin all sides.
  • pl-*is for padding left.
  • mt-*is for margin top.
  • mr-autois for margin right auto.
  • p-*用于填充所有边。
  • m-*是所有边的边距。
  • pl-*用于填充左侧。
  • mt-*用于边距顶部。
  • mr-auto用于保证金权利自动。

Spacing Utils Demo

间距实用程序演示

There are also display utilties.

还有显示实用程序

d-block, d-flex, d-inline-block, d-noneetc...

d-blockd-flexd-inline-blockd-none等...