首页›CSS-Tricks›文章

CSS timeline-scope: One Scroll, Multiple Carousels

Preethi · 2026年11月30日

AI 摘要 AI 生成,可能有误

本文介绍了 CSS 的 `timeline-scope` 属性,该属性允许一个元素正在跟踪的时间轴(例如滚动时间轴或视图时间轴)驱动父元素的任何子元素或后代元素中的动画。由于所有这些元素都在作用域内,一次滚动即可同时为多个元素添加动画,例如多个轮播图。

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.

CSS timeline-scope: One Scroll, Multiple Carousels originally handwritten and published with love on CSS-Tricks. You should really get the newsletter as well.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 CSS-Tricks

Expanded Font Fallbacks

AI 摘要The author describes replacing a project's heading font with a new variable font by registering it via a CSS @font-face rule, specifying the WOFF2 file, a font-weight range of 200 to 700, and font-display: swap. The piece, published on CSS-Tricks, focuses on handling expanded font fallbacks during this font swap.

alpha()

The CSS alpha() function takes a relative color and adds transparency to it. alpha() originally handwritten and published with love on CSS-Tricks. You should really get the newsletter as well.

Using light-dark() without getting caught out

AI 摘要This short CSS-Tricks post reflects on Martin Underhill's article about potential pitfalls when using the CSS light-dark() function. The author admits they hadn't considered the user and rendering considerations that could cause someone to get 'caught out,' despite relying heavily on light-dark() for their own site, and notes that the piece prompted them to reconsider their implementation choices.

RSS Club: Preview Art-Directed Scrollytelling Article

AI 摘要The author excitedly shares a preview of an upcoming art-directed scrollytelling article created in collaboration with long-time author Lee Meyer. The piece blends a 2013 aesthetic with modern 2026 techniques and will be published on CSS-Tricks. Readers are also encouraged to sign up for the newsletter.

Style Queries as Conditional Modifiers

AI 摘要The article explains that style queries are most useful when the condition and the styles need to live in different places, or when a single condition must affect several things at once. This enables components to keep working and adapt sensibly regardless of where they end up in a layout.