Bootstrap 导航栏下拉菜单项右侧 [英] Bootstrap Navbar Dropdown Menu Items Right

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

问题描述

如下图所示,当我点击铃铛图标时,图标右下角会出现一个下拉菜单.我希望这个下拉菜单出现在左下角而不是右下角.我该怎么办?

</nav>

解决方案

Bootstrap 5(2021 年更新)

使用 dropdown-menu 上的 dropdown-menu-end 类将菜单内的项目向右对齐..

 

https://codeply.com/p/kWLLKdjdpC

引导程序 4(原始答案)

使用 dropdown-menu-right 类将菜单内的项目向右对齐..

 

http://codeply.com/go/6Mf9aK0P8G

As you see in the picture below, when I click on the bell icon, a dropdown menu appears at the bottom-right of the icon. I want this dropdown menu to appear at bottom-left instead of bottom-right. What should I do?

<nav class="navbar">
  <div class="container">
    <div class="navbar-nav d-flex flex-row">
      ...
    </div>
  </div>
</nav>

解决方案

Bootstrap 5 (update 2021)

Use the dropdown-menu-end class on the dropdown-menu to align the items inside the menu right..

    <div class="dropdown-menu dropdown-menu-end">
        <a class="dropdown-item" href="#">Link</a>
        <a class="dropdown-item" href="#">Link</a>
        <a class="dropdown-item" href="#">Link</a>
    </div>

https://codeply.com/p/kWLLKdjdpC

Bootstrap 4 (original answer)

Use the dropdown-menu-right class to align the items inside the menu right..

    <div class="dropdown-menu dropdown-menu-right text-right">
        <a class="dropdown-item" href="#">Link</a>
        <a class="dropdown-item" href="#">Link</a>
        <a class="dropdown-item" href="#">Link</a>
    </div>

http://codeply.com/go/6Mf9aK0P8G

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

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆