I'm using a BEM approach to writing html + css. With this syntax:
- Blocks: block_name
- Elements: block_name__element_name
- Modifiers: block_name__element_name--modifier
I get confused when I have a block within another block. For instance, in a header, I want the header to be a block that I can reference and the nav and logo to be blocks. I want to reference those nav and logo blocks as being the within the site_header. But, how would I write that? Chaining blocks like block_name__sub_block_name seems quite long.
Does anyone have a typical way they would write this example?
<div class="site_header__logo">
<a class="site_header__logo__link">
<img class="site_header__logo__image">
</a>
</div>
<nav class="site_header__main_nav">
<ul>
<li class="site_header__main_nav__item">
<a class="site_header__main_nav__link">Home</a>
</li>
<li class="site_header__main_nav__item">
<a class="site_header__main_nav__link">About Us</a>
</li>
<li class="site_header__main_nav__item">
<a class="site_header__main_nav__link">Contact Us</a>
</li>
</ul>
</nav>
<div class="site_header__phone">
<p class="site_header__phone__number">
555.555.5555
</p>
</div>