2017-03-05 51 views
1

コレクション内に商品があるとします。 「feature-collection__product」という製品を「feature-collection」のブロック内の要素にするか、「feature-collection-product」と呼ぶのが適切ですか?その中に他の要素があるので、それが独自のブロックになります、または別の何か。正しいBEMスタイルの構文がわからない

<div class="feature-collection"> 

    <div class="feature-collection__product"> 
     <h2 class="feature-collection__product-title"></h2> 
     <h2 class="feature-collection__product-price"></h2>  
    </div> 

</div> 

OR

<div class="feature-collection"> 

    <div class="feature-collection-product"> 
     <h2 class="feature-collection-product__title"></h2> 
     <h2 class="feature-collection-product__price"></h2>  
    </div> 

</div> 

答えて

2

は、ほとんどの場合、正しい答えは両方です:

<div class="feature-collection"> 
    <div class="feature-collection__product product"> 
     <h2 class="product__title"></h2> 
     <h2 class="product__price"></h2>  
    </div> 
</div> 

あなたは同じDOMノード上の異なるエンティティを持っている状況がミックスと呼ばれています。この場合、独立したブロックの製品と、フィーチャコレクションのフィーチャコレクション内での制作のためのスタイリングを設定することは合理的です。ミックスについての詳細情報については

私が見https://en.bem.info/methodology/key-concepts/#mixhttps://en.bem.info/methodology/faq/#mixes

+0

ああをご覧ください。ありがとう! –

関連する問題