gpt4 book ai didi

html - Bootstrap V4 alpha - 如何在不接触 css 的情况下集中对齐导航项

转载 作者:行者123 更新时间:2023-11-28 15:44:41 25 4
gpt4 key购买 nike

enter image description here

我在左侧有一个导航栏,其中有几个下拉菜单。我想让文本在下拉菜单中居中对齐,或者在导航栏中更好地表示下拉菜单。怎么做? (如果可能的话不修改css)

我当前的代码片段 -

<nav class="col-sm-3 col-md-2 hidden-xs-down bg-faded sidebar">

<ul class="nav nav-pills flex-column">
<li class="nav-item">
<a class="nav-link active" href="https://v4-alpha.getbootstrap.com/examples/dashboard/#">Overview <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Region</a>
<div class="dropdown-menu">
<h6 class="dropdown-header">Dropdown header</h6>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Category</a>
<div class="dropdown-menu">
<h6 class="dropdown-header">Dropdown header</h6>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Brand</a>
<div class="dropdown-menu">
<h6 class="dropdown-header">Dropdown header</h6>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Packaging</a>
<div class="dropdown-menu">
<h6 class="dropdown-header">Dropdown header</h6>
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Separated link</a>
</div>
</li>

<!--<li class="nav-item">-->
<!--<a class="nav-link" href="https://v4-alpha.getbootstrap.com/examples/dashboard/#">Analytics</a>-->
<!--</li>-->
</ul>

</nav>

最佳答案

我不确定您所说的“居中对齐”是什么意思。您可以只使用 text-center 水平对齐文本。

<ul class="nav nav-pills flex-column text-center">
</ul>

http://www.codeply.com/go/J8C7RwDIDW

关于html - Bootstrap V4 alpha - 如何在不接触 css 的情况下集中对齐导航项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42993723/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com