The State of CSS
business logic 🤣
by Christoph @pistenprinz www.creinartz.de
There are only two hard things in Computer Science:
Cache invalidation
and naming things
Block - Standalone entity that is meaningful on its own.
Element A part of a block that has no standalone meaning and is semantically tied to its block.
Modifier A flag on a block or element. Use them to change appearance or behavior.
.btn {}
.btn__price {}
.btn--primary {}
Atomic CSS is the approach to CSS architecture that favors small, single-purpose classes with names based on visual function.
.f1 { font-size: 3rem; }
.ma0 { margin: 0; }
.text-huge { font-size: 3rem; }
.margin-0 { margin: 0; }
<p class="C(#fff) P(20px)">
Lorem ipsum
</p>
.C\(#fff\) { color: #fff; }
.P\(20px\) { padding: 20px; }
Variables var(--myvariable)
npm i node-sass
getComputedStyle
(document.documentElement)
.getPropertyValue
('--mycolour');
A tool for transforming CSS with JavaScript
The next evolution of best practices?
css-blocks.comBEM, ACSS, Autoprefixer, RTLCSS, CSSnano
Thank you!
Use a spacebar or arrow keys to navigate.
Press 'P' to launch speaker console.