如何在Bootstrap 4的导航栏下拉菜单中增加div大小

时间:2018-07-26 16:34:54

标签: html css bootstrap-4

我正在使用Bootstrap 4创建导航栏下拉菜单。但是在我的菜单项之一中,我想使用自己的代码自定义下拉菜单项。当我尝试此操作时,我无法增加下拉菜单内容的宽度。单击下拉链接后,它应该可以正确显示内容。

下面是代码。

    <nav class="navbar navbar-expand-sm navbar-light bg-white text-black">
    <div class="container">
        <button class="navbar-toggler" type="button" style="border:none;outline:0;" data-toggle="collapse" data-target="#navbarResponsive">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarResponsive">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link" href="#">T1</a>
                </li>

                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">
                        Dropdown link
                    </a>
                    <ul class="dropdown-menu" role="menu">
                        <li>
                            <div class="row">
                                <div class="col-sm-6">
                                    <div class="container">
                                        <div class="">
                                            <label label-default="" for="exampleInputEmail1">Email address</label>
                                            <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <div class="container">
                                        <div class="form-group">
                                            <label label-default="" for="exampleInputEmail1">Email address</label>
                                            <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </li>

                <li class="nav-item">
                    <a class="nav-link" href="#"> T2</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">t3</a>
                </li>
            </ul>
        </div>
    </div>
</nav>

我期望下面的输出。

enter image description here

1 个答案:

答案 0 :(得分:0)

您可以在min-width类中调整.dropdown-menu

例如编辑

.dropdown-menu {min-width: 30rem;}