gpt4 book ai didi

html - 更改 Bootstrap 导航栏上链接/按钮的宽度

转载 作者:行者123 更新时间:2023-11-28 03:04:03 24 4
gpt4 key购买 nike

我对 Bootstrap 导航栏中按钮的大小/宽度有疑问。我尝试在我的主 CSS 文件中将它们每个的宽度设置为 50%,以便它适合导航,但我仍然没有任何运气。似乎我想删除的链接之间有很多空间。有人可以帮我弄清楚我做错了什么吗?

HTML

        <nav class="navbar navbar-default navbar-fixed-top" role="navigation" bs-navbar>
<div class="navbar-header">
<a class="navbar-brand navbar-left" href="#">Brand</a>
</div>
<ul class="nav nav-justified navbar-right">
<li data-match-route="/$"><a href="#/" a id="HomeNav">Home</a></li>
<li data-match-route="/page-one"><a href="#/page-one" id="PageOne">Page One</a></li>
<li data-match-route="/page-two.*"><a href="#/page-two/sub-a" id="PageTwo">Page Two</a></li>
<li>
<a class="btn btn-sm btn-secondary-outline" href="/users/sign_up" id="SignUp">SIGN UP</a>
</li>
<li>
<a class="btn btn-sm btn-primary-outline" href="/users/sign_in" id="SignIn">SIGN IN</a>
</li>
<li>
<a class="btn btn-sm btn-gray-outline" href="/professionals/sign_in" id="People">People</a>
</li>
</ul>
</nav>

CSS

    #HomeNav {

max-width: 50%;
}

(例如)

最佳答案

很简单,你的<ul>标签设置不正确,改成这个 <ul class="nav navbar-nav">

HTML:

 <nav class="navbar navbar-default navbar-fixed-top" role="navigation" bs-navbar>
<div class="navbar-header">
<a class="navbar-brand navbar-left" href="#">Brand</a>
</div>
<ul class="nav navbar-nav">
<li data-match-route="/$"><a href="#/" a id="HomeNav">Home</a></li>
<li data-match-route="/page-one"><a href="#/page-one" id="PageOne">Page One</a></li>
<li data-match-route="/page-two.*"><a href="#/page-two/sub-a" id="PageTwo">Page Two</a></li>
<li>
<a class="btn btn-sm btn-secondary-outline" href="/users/sign_up" id="SignUp">SIGN UP</a>
</li>
<li>
<a class="btn btn-sm btn-primary-outline" href="/users/sign_in" id="SignIn">SIGN IN</a>
</li>
<li>
<a class="btn btn-sm btn-gray-outline" href="/professionals/sign_in" id="People">People</a>
</li>
</ul>
</nav>

演示:CodePen Example

关于html - 更改 Bootstrap 导航栏上链接/按钮的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33358558/

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