我试过所有在页眉和div类上都有margin-bottom和margin-top的东西,但没有任何反应。我想删除标题和下一个元素之间的空间,但要保持它们之间的白色边框。如何去除body标签中header和next div元素之间的空格?
这里是HTML和CSS充满的一部分:
img {
width: 200px;
border-radius: 15%;
border: 4px solid white;
margin-top: 20px;
}
body {
text-align: center;
background-color: #839F93;
font-family: helvetica, sans-serif;
}
ul {
padding: 15px;
list-style: none;
background: rgba(255, 255, 255, .5);
}
li {
display: inline;
padding: 0 10px 0 10px;
}
a {
color: black;
}
header {
background: #385044;
color: white;
border-bottom: 2px solid white;
}
h1 {
margin-top: 10px;
margin-bottom: 10px;
}
iframe {
border-radius: 30px;
border: white 2px solid;
}
<body>
<header>
<img src="picture-of-me.jpg" alt="Picture of Ivan">
<h1>Ivan's site</h1>
<ul>
<li><a href="index.html">Home</a>
</li>
<li><a href="#">About</a>
</li>
<li><a href="#">Contact</a>
</li>
</ul>
</header>
<div class="vangelis-chariots">
<h2>Vangelis - Chariots of fire</h2>
<iframe width="420" height="315" src="https://www.youtube.com/embed/TYJzcUvS_NU" frameborder="0" allowfullscreen></iframe>
<p>Click to play video and listen to music</p>
</div>
感谢编辑。 –