2016-05-10 150 views

回答

2

部分重叠,因为您在jumbotron上应用了position: absolute。带有absolutefixed的元素从DOM的正常流程中取出,因此它们与其他元素重叠。您可以将navbar设置为position: absolute而不是jumbotron,它可以工作。

示例代码

<nav class="navbar"> 
    // navigation 
</navbar> 
<div class="jumbotron"> 
    // jumbotron 
</div> 
<div class="next-section"> 
    // next section 
</div> 

body { 
    position: relative; 
} 

.navbar { 
    position: absolute; 
    z-index: 10; 
    right: 0; 
    left: 0; 
    top: 0; 
} 

.jumbotron { 
    height: 100vh; 
    width: 100%; 
} 

.next-section { 
    // styling will go here... 
} 

我已经更新了你的代码,看看它。你可以玩CSS来完全按照你的需要。 Link

+0

非常感谢!该作品 – Uzer

+0

@欢迎你,欢迎:) –

0

尝试将<div style="clear:both"></div>放置在上方栏后面。

+0

不起作用... – Uzer

0

jumbotron是一种对文本有影响的boostrap类,您还应该分配要占用的列来定义其宽度。将col-lg-12或带有jumbotron类的行分配给包装div。

+0

我试着添加它但仍然不起作用 – Uzer