gpt4 book ai didi

html - Bootstrap 4 下拉菜单位置

转载 作者:行者123 更新时间:2023-11-27 22:42:05 29 4
gpt4 key购买 nike

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

这是它在普通 View 中的样子 enter image description here

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

enter image description here

这是网站标题 HTML 的代码

<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>

CSS

/*items dropdown start */
#dropdown-categories{
background-color: #444;
}

.list-inline-item{
padding: 15px 10px;
font-size: 15px;
}

.categories-item{
color:white;
}

.categories-item:hover{
text-decoration: none;
color:white;
}
.dropdown-menu {
margin-top: 0;
width:1000px;
height:450px;
}

.dropdown-item{
font-size: 14px;
}

.dropdown:hover .dropdown-menu {
display: block;
}
/*items dropdown end */

如您所见,下拉菜单的位置很奇怪。我想让所有的下拉菜单都位于页面的中间,并且像这样具有相同的宽度和高度 enter image description here enter image description here

最佳答案

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

关于html - Bootstrap 4 下拉菜单位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59767934/

29 4 0