Hi,
I have a big disscusson with my colleague and would love to get your feedback.
I am building a website and have seen some areas, wich are reusable. They share the same HTML construct and looks similar. Example:
<header>
<nav class="navigation navigation_main">
<ul class="navigation__list">
<li class="navigation__item"><a class="navigation__link">Item 1</a></li>
<li class="navigation__item"><a class="navigation__link">Item 2</a></li>
<li class="navigation__item"><a class="navigation__link">Item 3</a></li>
</ul>
</nav>
<nav class="navigation navigation_meta">
<ul class="navigation__list">
<li class="navigation__item"><a class="navigation__link"><span class="svg-icon svg-icon_search"></span></a></li>
<li class="navigation__item navigation__item_active"><a class="navigation__link">DE</a></li>
<li class="navigation__item"><a class="navigation__link">EN</a></li>
</ul>
</nav>
</header>
My colleague says, that the navigations have to be named different:
<header>
<nav class="main-navigation">
<ul class="main-navigation__list">
<li class="main-navigation__item"><a class="main-navigation__link">Item 1</a></li>
<li class="main-navigation__item"><a class="main-navigation__link">Item 2</a></li>
<li class="main-navigation__item"><a class="main-navigation__link">Item 3</a></li>
</ul>
</nav>
<nav class="meta-navigation">
<ul class="meta-navigation__list">
<li class="meta-navigation__item"><a class="meta-navigation__link"><span class="svg-icon svg-icon_search"></span></a></li>
<li class="meta-navigation__item meta-navigation__item_active"><a class="meta-navigation__link">DE</a></li>
<li class="meta-navigation__item"><a class="meta-navigation__link">EN</a></li>
</ul>
</nav>
</header>
The navigations (there are some additional navigation in the footer and for social media icons, too) looks very similar. They differ in font size and paddings/margins. I see great advance in the first solution, because it is very modular and reusable. The end code is smaller. My colleague says, nesting (i.e. .navigation_meta .navigation__item{}
) is evil and should be avoided, whenever possible (i.e .meta-navigation__item{}
).
Who is right?