seyoungcho's profile
SeyoungCho@seyoungcho•May 16
2.9K

CSS Can Count Elements Now

From youtube.com•May 16•5m watch time

CSS is gaining two new built-in functions — sibling-index() and sibling-count() — that let stylesheets know an element's position within its siblings and the total sibling count. This enables JavaScript-free staggered animations (by calculating animation-delay dynamically per element), dynamic color gradients across a list (using OKLCH with a computed progress value), and even complex 3D carousel layouts using trigonometry. The feature eliminates the need for hardcoded nth-child rules or JS loops for position-based styling. Browser support is currently limited and not yet available in Firefox.

8 CommentsSmiley Face1 Award

Sort:

seyoungcho's user avatar
SeyoungCho
@seyoungcho
Joined Aug 29. 2024
2.9K

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard