Slides about ITCSS – an Inverted Triangle CSS architecture which will allow you to write maintainable and scalable stylesheets without pain.
EDIT:
I teamed with Artur Kot (https://twitter.com/arturkot) to update and enrich the presentation. Enjoy!
23. • .[component-name]__[child]—[modifier]
• Remember that it’s on only a convention!
• Use 🍌 instead of __ or 🍓instead —
if you like
• Important: separation of the parent
element and its children.
• Be consistent.
25. State classes
• .is-[name]
• .has-[name]
• should be used in favour of —modifiers
in case a component changes its state
after the page is loaded
• handy to use with JS
27. Temptation to target tags
.c-my-list li {
[item styles]
}
<ul>
<li>
<div class=”c-some-component-with-a-list”>
<ul>
<li>another list!</li>
<li>
and now you need to override
.c-my-list li with stronger selector...</li>
</ul>
</div>
</li>
</ul>
28. • You can’t predict the future. It’s possible that a
sneaky designer could design a nested list inside
your element. What to do then? More nesting. :)
• It, obviously, works but what if you’ve got identical
list but with divs instead of lis?
• Usually, nesting is like a domino effect: one
innocent nested selector results in dozen deeper
nested selectors. Avoid when possible.
29. You can’t entirely avoid
nesting. It’s impossible.
The goal is to minimise it and its side effects.