gpt4 book ai didi

twitter-bootstrap - 两行的 Bootstrap 导航栏

转载 作者:行者123 更新时间:2023-12-04 01:53:53 36 4
gpt4 key购买 nike

我想要一个具有两行导航元素的 Bootstrap 3 导航栏,并且导航栏品牌跨越两行。在 SM+ 屏幕尺寸上,两行都是可见的。在 XS 屏幕尺寸上,第二行折叠并显示要打开的图标栏。

SM+

+-------------------------------------------------------------------------------+
| | Nav-A-1 Nav-A-2 |
| SITE LOGO |---------------------------------------------------------------+
| | Nav-B-1 Nav-B-2 Nav-B-3 Nav-B-4 Form-Right |
+-------------------------------------------------------------------------------+

小号
+-------------------------------------------------------------------------------+
| | Nav-A-1 Nav-A-2 |
| SITE LOGO |---------------------------------------------------------------+
| | Nav-Collapsed Hamburger |
+-------------------------------------------------------------------------------+

导航栏怎么能做到这一点?

最佳答案

您基本上可以使用两个导航栏,然后使用 position: absolute为您的形象。您可能会使用网格,但您的折叠菜单很可能不会在移动设备上全角显示。

工作示例:

.navbar-inverse.nav-upper {
height: 50px;
}
.navbar-inverse.nav-upper ul {
float: right;
display: table;
}
.navbar-inverse.nav-upper .navbar-upper > li {
display: table-cell;
font-size: 14px;
}
.navbar-inverse.nav-upper .navbar-upper > li > a {
color: #777;
}
@media (min-width: 768px) {
.navbar.navbar-lower .navbar-nav {
margin-left: 100px;
}
}
.navbar-logo {
background-image: url('https://lh3.googleusercontent.com/-tw5LsU4Fg28/Umo6BBcoCnI/AAAAAAAAmjE/1iqULsem06E/w896-h896/heisencat.png');
width: 90px;
height: 90px;
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
position: absolute;
top: 5px;
left: 15px;
z-index: 1051;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<a class="navbar-logo" href="#"></a>

<nav class="navbar-inverse nav-upper">
<div class="container-fluid">
<ul class="nav navbar-upper">
<li><a href="#">NAV-A-1</a>
</li>
<li><a href="#">NAV-A-2</a>
</li>
</ul>
</div>
</nav>

<nav class="navbar navbar-inverse navbar-static-top navbar-lower">
<div class="container-fluid">

<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>

<div class="collapse navbar-collapse" id="navbar">
<ul class="nav navbar-nav">
<li><a href="#">NAV-B-1</a>
</li>
<li><a href="#">NAV-B-2</a>
</li>
<li><a href="#">NAV-B-3</a>
</li>
<li><a href="#">NAV-B-4</a>
</li>
</ul>
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search">
<span class="input-group-btn">
<button type="submit" class="btn btn-default">Submit</button>
</span>
</div>
</div>
</form>
</div>
</div>
</nav>

关于twitter-bootstrap - 两行的 Bootstrap 导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38112363/

36 4 0