<sibling-count>

A new experimental function that returns the total number of siblings an element has. This allows you to style elements based on how many items are currently in a list without using JavaScript.

/* Usage Example */
.grid-item {
  /* Make items larger if there are only a few in the list */
  width: calc(100% / sibling-count());
}
Limited availability Since 2020 70% global usage

This feature is not Baseline because it does not work in some of the most widely-used browsers.

138+
26.2+
138+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC