Hi there,
I have a navigation list, each items will need unique styling such as an icon/image applied to it. I've seen this handled a couple of different ways so I thought I'd put it to the forum and gets peoples thoughts on it. The standard mark-up would be something like this:
<nav class="site-nav">
<ul class="site-nav__list">
<li class="site-nav__item"><a href="#" class="site-nav__link">Schools</a></li>
<li class="site-nav__item"><a href="#" class="site-nav__link">Users</a></li>
</ul>
</nav>
Originally I thought I'd use a modifier and add classes like site-nav__item--users
for example. But quite a few sites I've looked at use an element instead, so site-nav__users
. So in full...
<nav class="site-nav">
<ul class="site-nav__list">
<li class="site-nav__item site-nav__schools"><a href="#" class="site-nav__link">Schools</a></li>
<li class="site-nav__item site-nav__users"><a href="#" class="site-nav__link">Users</a></li>
</ul>
</nav>
What's the thinking behind this and is there a right/wrong answer? Thanks in advance!
Hi!
I'd suggest to use modifiers here.
The only reason to convert them to elements is a chance to use
site-nav__schools
withoutsite-nav__item
(you can't use modifiers without something they modify).