我正在參加CSSzenGarden挑戰賽。我不得不改變它的樣式。我試圖把這些段落放在一個盒子裏,而不是把h3放在盒子裏面。我希望h3位於包含段落的框之上。如何僅將某個div的某些元素放入CSS框中
<div class="preamble" id="zen-preamble" role="article">
<h3>The Road to Enlightenment</h3>
<p>Littering a dark and dreary road lay the past relics of browser-specific tags, incompatible <abbr title="Document Object Model">DOM</abbr>s, broken <abbr title="Cascading Style Sheets">CSS</abbr> support, and abandoned browsers.</p>
<p>We must clear the mind of the past. Web enlightenment has been achieved thanks to the tireless efforts of folk like the <abbr title="World Wide Web Consortium">W3C</abbr>, <abbr title="Web Standards Project">WaSP</abbr>, and the major browser creators.</p>
<p>The CSS Zen Garden invites you to relax and meditate on the important lessons of the masters. Begin to see with clarity. Learn to use the time-honored techniques in new and invigorating fashion. Become one with the web.</p>
</div>
當我使用.preamble作爲css選擇器時,它將整個div放在方框內。當我使用.preamble p作爲選擇器時,它將每個段落放在一個單獨的框中。
如何在不包含h3的情況下將所有段落選爲一個組?
作品。優秀。這個想法之前,玩弄了,但無法讓它工作。 – Goose 2014-08-30 10:52:18
等等,我需要擺脫盒子頂部的空白空間。有沒有辦法抵消這一點? – Goose 2014-08-30 10:55:46
請參閱上面的修改。我忘了補償底部邊距。 – 2014-08-30 10:59:42