我想在白底黑和黑底白之間切換,只要遇到<h3>
就切換。這可能嗎?例如,在下面的代碼,css - 交替部分樣式?
<h3>Heading one</h3>
<p>The first paragraph.</p>
<p>The second paragraph.</p>
<p>The third paragraph.</p>
<h3>Heading two</h3>
<p>The fourth paragraph.</p>
<h3>Heading three</h3>
<p>The fifth paragraph.</p>
<p>The sixth paragraph.</p>
<h3>Heading four</h3>
<p>The seventh paragraph.</p>
<p>The eighth paragraph.</p>
<p>The ninth paragraph.</p>
標題一個和三個,和第1,第2,3,5,6將黑上白色;其他人將是白色的黑色。
實際的頁面內容是在Markdown中創作的,所以我不能簡單地將<div class="inverted">
(Markdown中HTML標籤的內容被解析爲HTML,但我希望它們被解析爲Markdown)中的一半部分。 )我知道nth-of-type
,但它隻影響標題本身。
你可能必須使用javascript/jquery – bsapaka