Bootstrap 5 导航栏右对齐项目 [英] Bootstrap 5 navbar align items right

查看:43
本文介绍了Bootstrap 5 导航栏右对齐项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 Bootstrap 5 导航栏项目向右对齐?在 Bootstrap 3 中,它是 navbar-right.在 Bootstrap 4 中,它是 ml-auto.但不适用于 Bootstrap 5.

How do you align Bootstrap 5 navbar items to the right? In Bootstrap 3 it's navbar-right. In Bootstrap 4 it's ml-auto. But not work for Bootstrap 5.

推荐答案

Bootstrap 5(2021 年更新)

自 Bootstrap 5 测试版起,RTL 支持.因此,Bootstrap 5 测试版的保证金实用程序发生了变化:

As of Bootstrap 5 beta, left and right have been replaced by start and end for RTL support. Therefore the margin utilities changed for Bootstrap 5 beta:

  • ml-auto =>ms-auto(开始)
  • mr-auto =>me-auto(结束)
  • ml-auto => ms-auto (start)
  • mr-auto => me-auto (end)

另请注意,所有左右的用法在 Bootstrap 5 中都被替换为 startend...

Also note, all uses of left and right have been replaced with start and end in Bootstrap 5...

  • ml-* =>ms-*
  • pl-* =>ps-*
  • 先生-* =>我-*
  • pr-* =>pe-*
  • text-left =>文本开始
  • text-right=>正文结束
  • 浮动左=>浮动启动
  • float-right=>浮动结束
  • border-left =>边界开始
  • border-right=>边界结束
  • 圆形左 =>圆角开始
  • 四舍五入-右=>圆头
  • dropleft =>启动
  • dropright=>下降
  • 下拉菜单--left =>下拉菜单--开始
  • 下拉菜单--right =>下拉菜单--end
  • carousel-item-left =>轮播项目开始
  • carousel-item-right=>carousel-item-end

Bootstrap 5 alpha(原始答案)

这个问题是针对 Bootstrap 5 alpha 提出的,因此 ml-auto 应该仍然有效.

This question was asked for Bootstrap 5 alpha, and therefore ml-auto should still work.

在 Bootstrap 5 中将导航项目向右对齐

这篇关于Bootstrap 5 导航栏右对齐项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆