CSS-Tricks is a learning community about all things front-end development
Designing Layouts With Personality
Using Fallbacks for a Robust Front-End
Staggering Scroll-Driven Animations
CSS-Tricks, Version 20
Animating CSS border-image
Gap Decorations Are Now Available, Here’s What’s New
Expanded Font Fallbacks
I’m replacing the heading font in a project with a new variable file. Easy enough to register the new font […]
CSS timeline-scope: One Scroll, Multiple Carousels
When an element tracks a timeline, like a scroll timeline or view timeline, that timeline can drive an animation in any of the parent element’s children or descendants because they’re all in scope. One scroll, many elements.
Using light-dark() without getting caught out
I honestly hadn’t thought about “getting caught” by light-dark() — particularly when leaning heavily on it for this site — but Martin Underhill explains the user and rendering considerations, making me reflect on my choices as well.
Style Queries as Conditional Modifiers
Where style queries shine is when the condition and the styles need to live in different places, or when one condition needs to affect several things at once: components that keep working, and adapt sensibly, no matter where they end up.
alpha()
.element { background-color: alpha(from orange / 25%); }
scroll-state()
@container getting-snappy scroll-state(snapped: y) {}
animation-trigger
.element { animation-trigger: --trigger play-forwards play-backwards; }
@function
@function --font-size() returns <length> { }
@custom-media
@custom-media --tablet (768px <= width <= 1024px);
rotate()
.element { transform: rotate(45deg); }
rotateX()
.element { transform: rotateY(60deg); }
rotateY()
.element { transform: rotateY(30deg); }
rotateZ()
.element { transform: rotateZ(90deg); }
view()
.element { animation-timeline: view(); }
scroll()
.element { animation-timeline: scroll(); }