gpt4 book ai didi

html - 试图在页面顶部的导航栏上方添加一个 div

转载 作者:太空宇宙 更新时间:2023-11-04 08:05:47 31 4
gpt4 key购买 nike

在导航栏顶部添加另一个 div 会完全改变导航栏本身的布局。HTML-

 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div>
<div class="top-bar">
<b>For sales inquiries</b>, call +1(866)965-1533 or <a>Request a free demo</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="navbar-header">
<a class="navbar-brand" href="#">SignEasy</a>
</div>
<ul class="nav navbar-nav" style="padding-left:140px;">
<li><a href="#">Features</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Industries <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li><a href="#">For Teams</a></li>
<li><a href="#">Pricing</a></li>
<li><a href="#">API</a></li>
<li><a href="#">Blog</a></li>
</ul>
<ul class="nav navbar-nav navbar-right" style="padding-right:67px;">
<li><a href="#">Link</a></li>
<button type="button" class="btn btn-default navbar-btn" style="border-radius:12px;background:#3793EE;color:white;">Start free trial</button>
</ul>
</div>
</div>

CSS-

.top-bar {
text-align:right;
background:#f4f4f4;
color:black;
}

在页面左上角出现问号- https://www.awesomescreenshot.com/image/2875140/418d9355f3a8c75b00d15a69d91b382b

最佳答案

为此,您需要在 navbar-collapse

上方添加单独的 div

工作 fiddle Demo

.top-bar {
text-align:right;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div>
<div class="top-bar">
For sles inquiries, call +1(866)965-1533 or Request a free demo
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">SignEasy</a>
</div>
<ul class="nav navbar-nav" style="padding-left:140px;">
<li><a href="#">Features</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Industries <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
<li><a href="#">For Teams</a></li>
<li><a href="#">Pricing</a></li>
<li><a href="#">API</a></li>
<li><a href="#">Blog</a></li>
</ul>
<ul class="nav navbar-nav navbar-right" style="padding-right:67px;">
<li><a href="#">Link</a></li>
<button type="button" class="btn btn-default navbar-btn" style="border-radius:12px;background:#3793EE;color:white;">Start free trial</button>
</ul>
</div>
</div>

关于html - 试图在页面顶部的导航栏上方添加一个 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46639348/

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