CSS Optimization: Is Using Declarations Just Once (UDJO) Still Effective Today?
Jens Oliver Meiert · 2026年11月10日
AI 摘要 AI 生成,可能有误
本文探讨了UDJO(Using Declarations Just Once,即声明只使用一次)——一种受DRY原则启发、通过识别并减少或消除CSS声明重复来优化代码的CSS优化技术——如今是否仍然是一种有效的优化策略。它最初以手写形式创作并发布在CSS-Tricks上,读者也被鼓励在该网站注册订阅新闻通讯。
Is the technique inspired by the DRY principle by identifying and reducing (if not eliminating) CSS declaration repetition still a relevant optimization strategy?
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.
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.
AI 摘要The article explains the CSS `timeline-scope` property, which allows a timeline being tracked by an element—such as a scroll timeline or view timeline—to drive animations in any children or descendants of a parent element. Because all these elements are in scope, a single scroll can animate multiple elements, such as several carousels, at once.
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.
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.