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

can i use an element within a block?

Open area73 opened this issue 9 years ago • 4 comments

I know that I can use a modifier within a block but, can I do this ? <span class="icon icon__item"> lorem ipsum </span>

area73 avatar May 18 '16 17:05 area73

According to convention icon__item would be a child element. What's wrong with just icon--item?

adi518 avatar Jun 21 '16 19:06 adi518

Did you mean icon is the parent? Then that means you are simply adding a modifier to the parent: icon Your modifier is --item. So please go for icon icon--item, because icon__item means 'item is the child of icon'. What you want is icon icon--item to say 'item is modifying the icon' 😃

Answer: <span class="icon icon--item"> lorem ipsum </span>

sumnermic avatar Jun 21 '16 19:06 sumnermic

@area73 Are you using 'bootstrap' library? I agree with the guys who has commented, the BEM ideology says 'icon_item' must be treated as an element, and you can't have both of them in the same tag.

Tecayehuatl avatar Apr 24 '17 14:04 Tecayehuatl

Actually it's possible to mix a block with its element on the same tag if there's a valid reason for such mix.

tadatuta avatar Apr 24 '17 14:04 tadatuta