I count at least three clever CSS techniques I didn’t know about.
A cute walkthrough for flexbox and grid.
Marcin explains why line height works differently in print and the web. Along the way, he hits upon this key insight about CSS:
Web also took away some of the control from typesetters. What in the print era were absolute rules, now became suggestions.
Remember that every line of CSS you write is a suggestion to the browser.
Font metrics help the computer determine things like the default spacing between lines, how high or low sub and super scripts should go, and how to align two differently sized pieces of text next to each other.
Rachel gives a terrific explanation of CSS layout from first principles, starting with the default normal flow within writing systems, moving on to floats, then positioning—relative, absolute, fixed, and sticky—then flexbox, and finally grid (with a coda on alignment). This is a great primer to keep bookmarked; I think I’ll find myself returning to this more than once.
Rachel provides an in-depth comparison between flexbox and grid layout: what they have in common, and what their respective strengths are.
Don’t forget to enable the experiment web features flag in your browser if you want to see the examples in action.
Here’s a clever way to get text centred when it’s short, but left-aligned when it wraps.
Here’s a nifty trick: using text-align: justify to get a nice responsive grid layout.
I am easily amused.
Khoi has posted the slides from his grids workshop online. Download and learn.