Bootstrap 4下拉ml-auto不适合页面

时间:2017-10-24 23:54:39

标签: twitter-bootstrap bootstrap-4

我正在使用bootstrap 4,我有一个下拉菜单。下拉列表显示在右侧。

  

问题如果链接位于右侧,如何确保下拉列表左侧

enter image description here

class vector3D {
private:
    float x, y, z;
public:
    vector3D();
    vector3D(const float);
    vector3D(const float, const float, const float);
    vector3D(const vector3D& v);
}; <== **semicolon**

1 个答案:

答案 0 :(得分:2)

解决方案下拉菜单右侧

<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
    <a class="dropdown-item" href="">Right Link</a>
    <a class="dropdown-item" href="">Members Waiting Approval <span class="badge badge-primary"><?php echo $newmember;?></span>
    </a>
</div>

导航栏

<nav class="navbar navbar-expand-lg bg-dark text-white">
    <div class="container-fluid">
    <a class="navbar-brand" id="button-menu"><i class="fa fa-bars" aria-hidden="true"></i> Menu</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
    <i class="fa fa-bars" aria-hidden="true" style="color: #ffffff;"></i>
    </button>
    <div class="collapse navbar-collapse" id="navbarNavDropdown">
        <ul class="navbar-nav ml-auto">
        <li class="nav-item">
        <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Alerts <i class="fa fa-chevron-down" aria-hidden="true"></i></a>
        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="">Right Link</a>
          <a class="dropdown-item" href="">Members Waiting Approval <span class="badge badge-primary"><?php echo $newmember;?></span>
        </a>
        </div>
        </li>
        <li class="nav-item">
            <a href="<?php echo base_url('admin/members/logout');?>" class="nav-link">Logout</a>
        </li>
        </ul>
    </div>
    </div>
</nav>