クラスを別の特定のクラスに再定義するにはどうすればいいですか?要素のすべての子孫にCSSルールを適用する方法
div.cls {
color:blue;
}
div.tst > div.cls {
color:red;
}
<div class="cls">test</div> // text color = blue
<div class="tst">
<div class="cls">test</div> // text color = red
<div>
<div class="cls">test</div> // text color = blue
</div>
<div>
最後の赤を作る方法も赤ですか?
コードは正常に動作するはずです。何を聞いていますか? – SLaks
あなたの質問は正確に何ですか?あなたが期待した色を持たないものがありますか? – Ernesto
'cls'クラスが直接' tst'の子ではない場合は? – clarkk