getbem.github.io icon indicating copy to clipboard operation
getbem.github.io copied to clipboard

Can we make element of block modifier?

Open learningcreature opened this issue 7 years ago • 2 comments

Hi there, I just wanted to know whether is following code is valid or not? Creating an element for the block modifier i.e. in this case "block--mod" is a modifier for the "block" block. Is it allowed to create a nested element with this pattern: "block--mod__elm". I am quite new to BEM and trying to understand it.

<div class="block block--mod">
   <div class="block__elm block--mod__elm">
</div>

learningcreature avatar Nov 16 '17 20:11 learningcreature

I think you're wanting the block__elm--mod

<div class="block block--mod">
   <div class="block__elm block__elm--mod">
</div>

My understanding is that the only order is Block -> Element -> Modifier. The element and/or modifier can be left off, but an element cannot ever follow a modifier.

From a CSS standpoint I have written mod classes that were wildcarded. Such as --full-width

garrypolley avatar Nov 16 '17 21:11 garrypolley

More chatter here https://github.com/getbem/getbem.com/issues/184

himedlooff avatar Feb 27 '19 23:02 himedlooff