§Legibility in Long Class Lists
Published on
One of the primary goals when writing code should be to make it easy to understand and quick to scan. Sometimes, using multiple CSS classes on an HTML element can make it harder to read.
Where it makes sense, I’ve been experimenting with separating different types of classes using a forward slash:
<div class="Card">
<span class="Card-icon / Icon Icon--close"></span>
...
</div>It’s a small thing, but it makes it much easier to spot where one group ends and the next begins.