I am trying to put the BEM naming convention in action but having some confusions about naming the HTML elements. I really want to understand do I really need to provide the class name for each HTML element.
Let's say I have the following code and for example:
<ul class="nav">
<li class="nav__list"><a href="#" class="nav__link>Home</a></li>
<li class="nav__list"><a href="#" class="nav__link>Services</a></li>
</ul>
I don't want to apply CSS to the <li>
elements.
So, in that case, do I need to use the element name for the <li>
tag. i.e. <li class="nav__list">...</li>
?
Can I just use the element name for the anchor tag without giving element name nav__list
to the <li>
element?
Here is what I am thinking to do because I don't want to apply styles to the CSS to <li>
:
<ul class="nav">
<li><a href="#" class="nav__link>Home</a></li>
<li><a href="#" class="nav__link>Services</a></li>
</ul>