【发布时间】:2019-01-06 12:03:11
【问题描述】:
我已经提到了这个问题,但无济于事:How would I remove the gap between the image and the Bootstrap Nav bar?
这是我目前所拥有的。
HTML:
<body>
<div class="nav">
<div class="container">
<ul class="nav nav-pills colour pull-right">
<li class="active">
<a href="#" id="home"
onmousedown="clickDown(this)"
onmouseup="clickRelease(this)">Home</a>
</li>
<li>
<a href="resume.html" id="resume"
onmousedown="clickDown(this)"
onmouseup="clickRelease(this)">Resume</a>
</li>
<li>
<a href="contact.html" id="contact"
onmousedown="clickDown(this)"
onmouseup="clickRelease(this)">Contact</a>
</li>
</ul>
</div>
</div>
<div class="header">
<div class="jumbotron">
<h1>Software developer</h1>
</div>
</div>
</body>
CSS:
.nav {
background-color: #536872;
letter-spacing: 4px;
line-height: 25px;
text-transform: uppercase;
margin-bottom: 0px;
}
.header {
margin-top: 0px;
}
.header h1 {
background-image: url("../images/contact.jpg");
background-size: cover;
background-position: 50% 50%;
line-height: 400px;
color: #FFFFFF;
text-align: center;
}
.jumbotron {
margin-top: 0px;
}
margin-bottom 和 margin-top 属性不应该关闭白色间隙吗?
感谢您阅读本文。
编辑:我自己解决了这个问题。我添加了<nav class="navbar navbar-fixed-top"> 来替换<div class="nav">
【问题讨论】:
-
你能把你的代码放在jsfiddle里吗?
-
我猜白色间隙应该是
<div class="container"></div>的一部分。有没有应用于.container类的css? -
由于某种原因,代码在 jsfiddle 上看起来很不正常(我从未使用过这个)。我很乐意在一些帮助下将其粘贴到 jsfiddle 中。
标签: html css twitter-bootstrap