简体   繁体   English

Bootstrap导航栏居中,但DIV高于内容

[英]Bootstrap Nav-Bar centered but DIV higher then content

after 1 hour of try and error and searching for problems like this, i try to get an answer here. 经过1个小时的尝试和错误并寻找类似的问题,我尝试在这里得到答案。

I want to include a bootstrap Nav-Bar into a Div. 我想将引导Nav-Bar包含在Div中。 I centered the Nav-Bar, but now my Div is higher then the content. 我将导航栏居中,但是现在我的Div高于内容。 This problem is only available when the Nav-Bar is centered. 仅当导航栏居中时,此问题才可用。 If i let if float left, the space below the Nav-Bar isnt there... 如果我让它向左浮动,则导航栏下方的空间不存在...

Screenshot (i want to remove the red-striped part) 屏幕截图(我要删除红色条纹的部分)

here my Code: 这是我的代码:

Code

a margin-bottom:0; margin-bottom:0; will do the trick if added to navbar 如果将其添加到navbar将达到目的

.navbar {
    margin-bottom:0;
 }

This is a bootstrap example with both navbar and jumbotron 这是navbar和jumbotron的引导示例

Try this: 尝试这个:

#header {        
    color: white;
    width: 100%;
    background-color: #222222;
    font-weight: 100;   
    margin: auto;
    padding: 30px 0;
    text-align: center; 
    font-size: 1.2em;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM