https://codepen.io/bazzle/pen/jyWdjMCSS第一の型、親のではなく、さらに子孫が
私が最初にp
ではなく、BLOCKQUOTE内にネストされたp
、またはその他の要素を選択します。言い換えれば
<div class="article__body">
<p>
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
</p>
<blockquote>
<p>
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
</p>
</blockquote>
<p>
It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
</p>
</div>
S 'のp
孫のではなく、' すべての子p
のうちp
最初のCSS(以下)
.article__body{
p:first-of-type{
background-color:green;
}
}
を試してみてください。あなたは真剣に質問する前に検索を検討する必要があります。 – Harry
@ハリーはい、正確に。 –
'.article__body> p:first-child {}'? – Banzay