Bootstrap 4下拉菜单位置

时间:2020-01-16 10:46:16

标签: html css bootstrap-4

我正在使用引导程序4。这是我的情况。我想制作一个带有不同类别下拉菜单的网站标题。

这是普通视图下的样子 enter image description here

悬停时查看/单击下拉菜单 enter image description here

enter image description here

这是网站标题HTML的代码

<img>

CSS

<div id="dropdown-categories"class="container-fluid">
            <ul class="list-inline d-flex justify-content-center">
                <li class="list-inline-item dropdown">
                    <a class="categories-item dropdown-toggle" href="#" id="Hardware" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-offset="10,20">
                    Hardware
                    </a>
                    <div class="dropdown-menu" aria-labelledby="Hardware">
                        <div class="row">
                            <div class="col-md-3">
                                <div class="multi-column-dropdown">
                                    <p class="dropdown-item dropdown-head">Plumbing</p>

                                    <a class="dropdown-item" href="decorer.php">Pipes</a>

                                    <a class="dropdown-item" href="dholwale.php">Hoses<a>

                                    <a class="dropdown-item" href="dholwale.php">Water Taps</a>

                                    <a class="dropdown-item" href="dholwale.php">Shower Heads</a>

                                    <a class="dropdown-item" href="dholwale.php">Drain Cleaners</a>

                                    <a class="dropdown-item" href="dholwale.php">Accessories</a>

                                </div>
                            </div>

                            <div class="col-md-3">
                            <ul class="multi-column-dropdown">
                               <p class="dropdown-item dropdown-head">Power & Hand Tools</p>

                               <a class="dropdown-item" href="decorer.php">Drills</a>

                               <a class="dropdown-item" href="dholwale.php">Measuring Tape</a>

                               <a class="dropdown-item" href="dholwale.php">Screwdrivers</a>

                               <a class="dropdown-item" href="dholwale.php">Hammers</a>

                               <a class="dropdown-item" href="dholwale.php">Spanners</a>

                               <a class="dropdown-item" href="dholwale.php">Ladders</a>

                               <a class="dropdown-item" href="dholwale.php">Trolleys</a>

                               <a class="dropdown-item" href="dholwale.php">Tools</a>

                               <a class="dropdown-item" href="dholwale.php">Saws</a>

                               <a class="dropdown-item" href="dholwale.php">Cutters</a>

                               <a class="dropdown-item" href="dholwale.php">Tool Boxes</a>

                               <a class="dropdown-item" href="dholwale.php">Tape</a>

                               <a class="dropdown-item" href="dholwale.php">Accessories</a>

                            </ul>
                            </div>

                        </div>

                    </div>
                </li>

                <li class="list-inline-item dropdown">
                    <a class="categories-item dropdown-toggle" href="#" id="Electrical" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-offset="10 20">
                        Electrical
                    </a>
                    <div class="dropdown-menu" aria-labelledby="Electrical" >
                        <div class="row">
                            <div class="col-md-3">
                                <div class="multi-column-dropdown">
                                    <p class="dropdown-item dropdown-head">Power & Hand Tools</p>

                                    <a class="dropdown-item" href="decorer.php">Drills</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </li>

                <li class="list-inline-item dropdown">
                    <a class="categories-item dropdown-toggle" href="#" id="Household" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-offset="10 20">
                        Household
                    </a>
                    <div class="dropdown-menu" aria-labelledby="Household" >
                        <div class="row">
                            <div class="col-md-3">
                                <div class="multi-column-dropdown">
                                    <p class="dropdown-item dropdown-head">Housekeeping </p>

                                    <a class="dropdown-item" href="decorer.php">Garbage Bag</a>
                                </div>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>

如您所见,下拉菜单的位置很奇怪。我想使所有的下拉菜单都在页面的中间,并与这样的宽度和高度保持一致 enter image description here enter image description here

1 个答案:

答案 0 :(得分:0)

从类.dropdown-menu中删除宽度和高度。并避免使用固定的宽度和高度