我正在参加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