标题部分和图片之间有一个小缝隙,我该如何摆脱它?是否有某种默认保证金?横幅中有图像。
html,
body {
font-family: Bahnschrift;
font-size: 13;
}
.wrap {
max-width: 1100px;
margin: 0 auto;
}
header {
width: 100%;
height: 108px;
background-color: #001e22;
}
img {
margin-top: 17px;
}
nav {
float: right;
margin-top: 35px;
}
li {
font-size: 18px;
display: inline-block;
margin-left: 48px;
}
a {
color: white;
text-decoration: none;
}
.banner {
width: 100%;
height: 500px;
}
<header>
<div class="wrap">
<img src="logo.png">
<nav>
<ul>
<li><a href="">CONTACT US</a></li>
<li><a href="">SOFTWARE USED</a></li>
<li><a href="">PROJECT</a></li>
<li><a href="">ABOUT US</a></li>
<li><a href="">HOME</a></li>
</ul>
</nav>
</div>
</header>
<section class="banner">
<img src="building.png" alt="banner">
</section>
答案 0 :(得分:1)
您的img
选择器还在主体图像上添加了页边距,因此您需要更加具体(例如,使用header > img
)
html,
body {
font-family: Bahnschrift;
font-size: 13;
}
.wrap {
max-width: 1100px;
margin: 0 auto;
}
header {
width: 100%;
height: 108px;
background-color: #001e22;
}
header > img {
margin-top: 17px;
}
nav {
float: right;
margin-top: 35px;
}
li {
font-size: 18px;
display: inline-block;
margin-left: 48px;
}
a {
color: white;
text-decoration: none;
}