Bootstrap 导航栏中的白色左右边距 [英] White right and left margins in Bootstrap navbar
问题描述
这个问题一直困扰着我.我正在使用 Bootstrap 框架,每当我在移动设备上查看我的网站时,我都会在导航栏的右侧和左侧获得 20 像素的边距.
This issue has been bothering me forever. I'm using the Bootstrap framework and whenever I view my site on mobile devices I get 20px margins on the right and left side of the navbar.
过去有人提出以下建议:
In the past some have suggested the following:
.navbar-fixed-top {
margin-left: -20px;
margin-right: -20px;
}
不幸的是,这不起作用.它解决了导航栏边距的问题,但会导致页面其余部分出现问题.
Unfortunately, this doesn't work. It solves the issue with the navbar margins but creates issues with the rest of the page.
您可以在此处查看此问题的示例:http://www.theplaybook.co
You can view an example of this problem here: http://www.theplaybook.co
非常感谢任何见解.
推荐答案
这是由这一行引起的(在 bootstrap-responsive.css
中,第 802 行):
It's caused by this line (in bootstrap-responsive.css
, line 802):
@media (max-width: 767px) {
.navbar {
padding: 0 20px;
}
这篇关于Bootstrap 导航栏中的白色左右边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!