我試過所有在頁眉和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>
感謝編輯。 –