twitter-bootstrap 如何从 Bootstrap 导航栏中删除默认填充
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26727581/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How To Remove Default Padding From Bootstrap Nav Bar
提问by KiV
BootstrapJS/CSS is appending transparent space to the bottom of a NavBarinside a <td>in my home page. Thisshows a live previewof the issue I'm having with the default bootstrapconfiguration of NavBars.
引导JS / CSS被附加的透明空间的底部NavBar内的<td>在我的主页。这显示了我在使用默认引导程序配置时遇到的问题的实时预览NavBars。
Here is a complete, (minus the inclusion of the bootstrapfiles) and minimal example of the code I wrote to create the NavBar.
这是一个完整的,(减去列入的引导文件)和小例子,我写了创建的代码NavBar。
<html>
<body>
<table align="center" border="1px"><tr>
<td>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-static-top" 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="#bs-example-navbar-collapse-1">
<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="index.html">Home</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
<a href="about.html">About Us</a>
</li>
<li>
<a href="contact.html">Contact Us</a>
</li>
<form class="navbar-form navbar-right" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
</td></tr>
</table>
</html>
Any help is appreciated. Cheers.
任何帮助表示赞赏。干杯。
回答by KiV
You can update the css class "navbar" with updated margin.
您可以navbar使用更新的边距更新 css 类“ ”。
.navbar { margin-bottom: 0 }
回答by paulalexandru
The cleanest solution for this is, when you export your boostrap version from here, just edit the @navbar-margin-bottomfield, you should set it to 0px insted of @line-height-computed(default value).
最干净的解决方案是,当您从此处导出 boostrap 版本时,只需编辑该@navbar-margin-bottom字段,您应该将其设置为 0px insted of @line-height-computed(默认值)。

