5 CSS Values for Easier Text Styling
Sometimes picking the right value matters more than picking the right property. Here are five CSS values (unset, AccentColor, ch, from, and revert-layer) that take a lot of the work out of styling text.
Sometimes picking the right value matters more than picking the right property. Here are five CSS values (unset, AccentColor, ch, from, and revert-layer) that take a lot of the work out of styling text.
CSS doesn’t have a boolean type, but it does have the true and false keywords. Register a custom property that only accepts them, flip it with :has(), and container style queries turn messy :checked selector combinations into readable conditions.
Divs and spans are fine, but purposefully meaningless. Often the meaning actually matters, so let’s look at some of those situations.
It’s not just vibes, it’s an accessibility thing.
The new CSS progress() function maps a given value to a range. Super useful for responsive layouts, responsive typography, and fun tricks.
“Liquid glass” design is helped along by offsetting/scaling the background as if you’re looking through real glass. But that gets tricky with arbitrary CSS background positioning.
Includes background-clip for masking backgrounds, vertical-align for aligning elements, box-decoration-mode for consistent edge styling, letter-spacing for spacing control, and text-combine-upright for vertical text layouts.
Here’s an example. You can list multiple comma-separated box-shadows, but if you apply a *new* box-shadow, it overrides anything set before. Not true here.
You might think of the view() function as used in scroll-driven animations, but really it just pairs @keyframes animation with the current position of an element.
Using @counter-style for tricky visual effects like word rotation and obfuscation.
Master.dev donates to open source projects through thanks.dev and Open Collective, as well as donates to non-profits like The Last Mile, Annie Canons, and Vets Who Code.