我想从导航栏中删除额外的填充,但是在制作底部填充后甚至无法执行填充0.它低于导航栏选项。我也在网上搜索但无法获得解决方案。 以下是html代码
<div class="navbar navbar-fixed-top" role="navigation">
<div class="navbar-header">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img style="max-width: 100px; margin-top: -7px;"
src="images/Logo.png">
</a>
<div class="complete">
</div>
</div>
<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>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav pull-right">
<li><a href="#">Link</a></li>
</ul>
</div>
<div class="navbar navbar-inverse navbar-static-top" style="background-color: gray;" role="navigation">
<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>
</div>
<div class="collapse navbar-collapse" style="background-color: lightgray;">
<ul class="nav navbar-nav">
<li role="presentation"><a runat="server" href="/Default">Home</a></li>
<li role="presentation"><a runat="server" href="/Report"> Report</a></li>
<li role="presentation"><a runat="server" href="/server">server</a></li>
<li role="presentation"><a runat="server" href="/Engine">Management</a></li>
<li role="presentation"><a runat="server" href="/Class">Management</a></li>
<li role="presentation"><a runat="server" href="/User">User</a></li>
</ul>
</div>
</div>
</div>
和CSS代码
`
/* --- Style --- */
body {
padding-top: 150px;
}
.navbar{
background-color:darkseagreen;
margin-bottom: 0;
}
.navbar-header{
background-color:darkseagreen;
padding-top: 4px;
padding-bottom:4px;
}
.nav {
background-color:forestgreen;
margin-top:0px;
margin-bottom:0px;
}
`
任何帮助都会很棒。提前致谢
答案 0 :(得分:0)
请尝试一次,不要在此代码中添加样式并检查一次。
<div class="navbar navbar-fixed-top" role="navigation">
<div class="navbar-header">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img style="max-width: 100px; margin-top: -7px;"
src="images/Logo.png">
</a>
<div class="complete">
</div>
</div>
<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>
</div>
<div class="navbar navbar-inverse navbar-static-top" style="background-color: gray;" role="navigation">
<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>
</div>
<div class="collapse navbar-collapse" style="background-color: forestgreen;">
<ul class="nav navbar-nav">
<li role="presentation"><a runat="server" href="/Default">Home</a></li>
<li role="presentation"><a runat="server" href="/Report"> Report</a></li>
<li role="presentation"><a runat="server" href="/server">server</a></li>
<li role="presentation"><a runat="server" href="/Engine">Management</a></li>
<li role="presentation"><a runat="server" href="/Class">Management</a></li>
<li role="presentation"><a runat="server" href="/User">User</a></li>
</ul>
<ul class="nav navbar-nav pull-right">
<li><a href="#">Link</a></li>
</ul>
</div>
</div>
答案 1 :(得分:0)
<style type="text/css">
/* --- Style --- */
body {
padding-top: 150px;
}
.navbar{
background-color:darkseagreen;
margin-bottom: 0;
}
.navbar-header{
background-color:darkseagreen;
padding-top: 4px;
padding-bottom:4px;
}
.nav {
background-color:forestgreen;
margin-top:0px;
margin-bottom:0px;
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="navbar navbar-fixed-top" role="navigation">
<div class="navbar-header">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img style="max-width: 100px; margin-top: -7px;"
src="images/Logo.png">
</a>
<div class="complete">
</div>
</div>
<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>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav pull-right">
<li><a href="#">Link</a></li>
</ul>
</div>
<div class="navbar navbar-inverse navbar-static-top" style="background-color: gray; margin-bottom: 0px;" role="navigation">
<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>
</div>
<div class="collapse navbar-collapse" style="background-color: lightgray;">
<ul class="nav navbar-nav">
<li role="presentation"><a runat="server" href="/Default">Home</a></li>
<li role="presentation"><a runat="server" href="/Report"> Report</a></li>
<li role="presentation"><a runat="server" href="/server">server</a></li>
<li role="presentation"><a runat="server" href="/Engine">Management</a></li>
<li role="presentation"><a runat="server" href="/Class">Management</a></li>
<li role="presentation"><a runat="server" href="/User">User</a></li>
</ul>
</div>
</div>
</div>
答案 2 :(得分:-1)
试试这个css代码
body {
margin:0px;
padding-top: 150px;
}