sibling-count() and sibling-index()
Since August 2026 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
With sibling-index and sibling-count, we can do visual changes to a UI based on the total number of siblings, or the index of the current sibling.
.item {
--size: 3rem;
--l: calc(3 * sibling-index());
background-color: hsl(from deeppink h s calc(l + var(--l)));
}Take a look at the demo below and resize the wrapper.