Skip to content

Conversation

sagarp2901
Copy link

Description

This PR fixes the “Ordered list” example on the sibling-index() documentation page.

Motivation

The bug: The old example set content: var(--list-index); where --list-index was just an integer. The CSS content property does not accept raw numbers, so the pseudo-element would render nothing.

The fix: By introducing a CSS counter (counter-set + counter()), the numeric value from sibling-index() is converted into a valid, displayable string.

Additional details

Related issues and pull requests

Fixes #41290

@sagarp2901 sagarp2901 requested a review from a team as a code owner September 30, 2025 04:12
@sagarp2901 sagarp2901 requested review from estelle and removed request for a team September 30, 2025 04:12
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed labels Sep 30, 2025
Copy link
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fixes the issue, I think it's an antipattern since you should just use counter() in this case. @ramiy WDYT? We should remove this example and/or replace it with something more reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSS example has type incompatibility
3 participants