シンプルなボックスを定義するために、次の BEM スタイルの Css があります。
.box { /*styles */ }
.box__heading {/*styles */}
.box__image { /*styles */}
また、ボックスをエラー モードで表示できるようにする必要があるため、次の修飾子を定義しました。
.box--error {/*styles */}
私が抱えている問題は、ボックスがエラー モードのときに box__heading などのネストされた要素のスタイルを定義する良い方法を見つけることです。
親だけでなく見出しにも修飾子を定義しますか?
<div class="box box--error">
<h2 class="box__heading box__heading--error"></h2>
</div>
または、CSSでこれを行うだけですか:
.box--error {}
.box--error .box__heading { /* error styles*/ }