gpt4 book ai didi

html - 使用 bootstrap navbar collapse 维护侧边栏格式

转载 作者:行者123 更新时间:2023-11-28 05:33:40 25 4
gpt4 key购买 nike

当全屏时,我已经设法保持了一种让我感到舒服的格式。然而,当屏幕变小,侧边栏折叠起来,并且可以通过汉堡包按钮访问时,当我点击按钮显示侧边栏时,格式完全改变了。如何维护侧边栏的格式?这是 html:

<div class="container">
<div class="row">
<!--Collapsable navbar-->
<div class="sidebar-nav">
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header" >
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-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>
<span class="visible-xs navbar-brand">Logo</span>
</div>

<div class="navbar-collapse collapse sidebar-navbar-collapse">
<button type="button" class="btn btn-default">
<span class="glyphicon glyphicon-menu-left leftarrow" aria-hidden="true"></span>
</button>
<ul class="nav navbar-nav mylist" style="align-items:center">
<!-- logo-->
<img src="https://s3.amazonaws.com/crowdhoster/uploads/settings/logo_images/000/000/001/original.png?1410418498" width="80" height="30" margin-left="90">
<br>
<br>
<!--User icon to add in profile picture-->
<div class="row" style="align-items:center">
<div class="img-circle usericon" >
<img src="http://i.stack.imgur.com/dolAE.png" class="img-circle img-responsive usericon tint">
<div class="caption">
<label for='picture'>
<img src="http://i.stack.imgur.com/XMojX.png" style="cursor:pointer">
</label>
<form action="demo_form.asp" style='display: none;'>
<input type="file" name="pic" accept=".gif,.jpg,.png,.tif|image/*" id='picture'>
<input type="submit">
</form>
</div>
</div>
</div>
<br>
<br>
<p style="font-size:22px; line-height: 8px">userN</p>
<p style="font-size:14px">emailAddress</p>

<!-- Navbar menu -->
<li><a style="cursor:pointer" go-click="/dashboard">Dashboard</a></li>
<li><a style="cursor:pointer" go-click="/keyholder">People</a></li>
<li><a style="cursor:pointer" go-click="/devices">Devices</a></li>
<li><a style="cursor:pointer" go-click="/about">About</a></li>
<li><a style="cursor:pointer" go-click="/notifications">Notifications</a></li>
<li><a style="cursor:pointer" go-click="/analytics">Analytics</a></li>
</ul>
<a class="nav navbar-nav logout" style="cursor:pointer; align-items:center" go-click="/signout">Log Out</a>
</div><!--/.nav-collapse -->
</div>
</div>

<div class="col-sm-9">

</div>
</div>
</div>

非常感谢。如果您需要任何 css,请告诉我,因为该代码块中有一些类适用于格式化。

CSS:

@media (min-width: 768px) {
.sidebar-nav .navbar .navbar-collapse {
padding-top: 24px;
background-color: #FFFFFF;
border-radius: 16px !important;
max-height: none;
position: absolute;
border-width: thin;
border-style: solid;
border-color: #f44336 !important;
}
.sidebar-nav .navbar ul {
width: 235px;
height: 676px;
color: #f44336;
background-color: #FFFFFF;
font-family: 'Roboto';
font-size: 16px;
text-align: center;
float: none;
display: block;
}
.sidebar-nav .navbar li {
float: none;
display: block;
}
.sidebar-nav .navbar li a {
padding-top: 12px;
color: #f44336;
background-color: #FFFFFF;
font-family: 'Roboto';
text-align: center;
font-size: 16px;
padding-bottom: 12px;
}

最佳答案

你的 Bootstrap css 中有这个:

@media (min-width: 768px){ 
.navbar-nav>li {
float: left;
}
}

只需将 float left 添加到您的 .nav > li:

.nav>li {
position: relative;
display: block;
float: left;
}

关于html - 使用 bootstrap navbar collapse 维护侧边栏格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38357081/

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