Bootstrap 5 类“me-auto”的含义是什么

Rit*_*man 21 twitter-bootstrap bootstrap-5

这是 bootstrap 5 navbar ul 部分代码。我的问题是:

  1. 我无法从左到右更改 ul 位置。

  2. bootstrap 5类“me-auto”的含义是什么

  3. 链接下拉菜单
  4. 行动
  5. 另一个动作
  6. 这里还有其他东西
  7. 残疾人

小智 17

更改.me-auto.ms-auto将其向右移动。


小智 13

mr-auto => bootstrap 4 边距右自动

me-auto => bootstrap 5 边距 end-auto

https://getbootstrap.com/docs/5.0/utilities/spacing/#margin-and-padding

  • 也许这值得稍微解释一下? (7认同)

MOH*_*ZAD 6

me-auto 的意思是“保证金结束自动”。这实际上是:

margin-right: auto
Run Code Online (Sandbox Code Playgroud)

me = 右边距,ms = 左边距

要验证我的答案,您可以在此处下载 bootstrap 5.0: https: //getbootstrap.com/docs/5.0/getting-started/download/

打开 css/bootstrap.css 文件,然后搜索这个 className(me-auto),你会在那里找到它的 css 代码。


Aid*_*tan 5

快速回答

这是在 Bootstrap 5 中设置间距的最佳方式,对于 LTR 和 RTL 书写系统都很友好。

  • me代表margin-end
  • me-autoLTR 中相当于mr-autoBootstrap 4 及之前的版本。

有兴趣可以详细了解

Bootstrap 5 中的间距类使用以下格式命名:

  • {property}{sides}-{size}对于xs,
  • {property}{sides}-{breakpoint}-{size}适用于 sm、md、lg、xl 和 xxl。

其中财产是以下之一:

  • m - 对于设置边距的类
  • p - 用于设置填充的类

其中 side 是以下之一:

  • t - 对于设置 margin-top 或 padding-top 的类
  • b - 对于设置 margin-bottom 或 padding-bottom 的类
  • s - (开始)对于在 LTR 中设置 margin-left 或 padding-left,在 RTL 中设置 margin-right 或 padding-right 的类
  • e - (end) 用于在 LTR 中设置 margin-right 或 padding-right,在 RTL 中设置 margin-left 或 padding-left 的类
  • x - 对于同时设置 *-left 和 *-right 的类
  • y - 对于同时设置 *-top 和 *-bottom 的类
  • 空白 - 用于在元素的所有 4 侧设置边距或填充的类

其中大小是以下之一:

  • 0 - 对于通过将其设置为 0 来消除边距或填充的类
  • 1 - (默认)对于将边距或填充设置为 $spacer * .25 的类
  • 2 - (默认)对于将边距或填充设置为 $spacer * .5 的类
  • 3 - (默认)对于将边距或填充设置为 $spacer 的类
  • 4 - (默认)对于将边距或填充设置为 $spacer * 1.5 的类
  • 5 - (默认)对于将边距或填充设置为 $spacer * 3 的类
  • auto - 用于将边距设置为自动的类

https://getbootstrap.com/docs/5.0/utilities/spacing/#margin-and-padding


小智 0

  1. 如果没有看到代码,我们无法帮助您从左到右对齐,或者您可能会使用。

float:right或者你可以使用这个CSS:

.lefttoright {
  position: relative;
  right: 5px;
}
Run Code Online (Sandbox Code Playgroud)
  1. me-auto将两个项目推到右侧。