gpt4 book ai didi

html - 如何创建带有 Logo 、搜索框和链接的响应式导航栏并且仍然响应?

转载 作者:行者123 更新时间:2023-11-28 09:59:56 25 4
gpt4 key购买 nike

我正在尝试使用 BS 3 实现两行导航,但我很难找到如何实现它。我试过的每一种方法都失败了。我想尽可能保持标记的标准。这是我想要的样子:

http://jsfiddle.net/technotarek/ePGa9/

该示例使用旧的 BS 代码。我似乎无法让它在 BS 3.0 中工作。

这是我的尝试。 Logo 很大,但我希望它相应地缩放。

<nav class="navbar navbar-default" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="/"><img class="img-responsive" src="http://placehold.it/490x164&text=Logo" alt="My Logo"></a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse">
<form class="navbar-form pull-right">

<div class="input-group">
<input type="text" class="search-box-text form-control" />
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><i class="icon-search"></i></button>
</span>
</div>
</form>

<ul class="nav navbar-nav pull-right">
<li><a href="/register" class="ico-register">Register</a></li>
<li><a href="/login" class="ico-login">Log in</a></li>
</ul>

</div><!-- /.navbar-collapse -->
</div>
</nav>

最佳答案

您的代码在这里 BootstrapNavbarWithLogoSearchbarResponsive

html


    <div class="navbar navbar-default">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"> <img src="http://placehold.it/70x70">
</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Active</a></li>
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li class="dropdown-header">Dropdown header</li>
<li><a href="#">Separated link</a></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<input type="text" class="form-control col-lg-8" placeholder="Search">
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</li>
</ul>
</div>
</div>

CSS


    .navbar-brand {
float: left;
height: 10%;
padding: 0;
}

关于html - 如何创建带有 Logo 、搜索框和链接的响应式导航栏并且仍然响应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24750130/

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