我聽說過摺疊邊距,但不知道這是怎麼回事。這是一個迷你版本的代碼:JSFiddle。我試圖將「標題」和「我是文本」之間的間隔增加到45 px,方法是將margin-bottom應用於「標題」。有人可以幫我找出問題嗎?謝謝。無法使用margin-bottom來增加標題之間的間距
HTML:
<header id="title">Title</header>
<h6>I am text.</h6>
CSS:
header #title {
margin-top:0;
margin-bottom:45px;
font-family: "Book Antiqua";
}
h6 {
font-style: italic;
font-size: 12pt;
font-weight: normal;
margin-top: 12pt;
margin-bottom: 0;
}
你有id爲'title' _inside_一個'header'元素的任何元素... – CBroe
標題標籤應該有H6標籤初始化 – agconti
作爲@CBroe指出,使用'header#title'來代替,或者只是'#title',因爲這個id是唯一的。 –