更新时间:2023-01-10 10:34:59
原来所有的navbar-nav>li
默认都有一个float: left
属性> 元素,这就是为什么它们都向左蜷缩.一旦我添加了下面的代码,它就会使 navbar
居中而不是皱缩起来.
It turns out that there is a float: left
property by default on all navbar-nav>li
elements, which is why they were all scrunching up to the left. Once I added the code below, it made the navbar
both centered and not scrunched up.
.navbar-nav>li {
float: none;
}
希望这对希望将 navbar
居中的其他人有所帮助.
Hope this helps someone else who's looking to center a navbar
.