Why does BEM often use two underscores instead of one for modifiers?

前端 未结 5 1960
梦如初夏
梦如初夏 2021-01-31 18:26

In BEM, I understand that with modifiers, two dashes makes sense so that you can distinguish the modifier in my-block-my-modifier with my-block--my-modifier

5条回答
  •  忘掉有多难
    2021-01-31 19:16

    Because whose blocks can be hyphen or underscore delimited, for example:

    .site-search {} /* Block */
    .site-search__field {} /* Element */
    .site-search--full {} /* Modifier */
    

    or

    .site_search {} /* Block */
    .site_search__field {} /* Element */
    .site_search--full {} /* Modifier */
    

提交回复
热议问题