Skip to content

Add nth-* variants#13661

Merged
thecrypticace merged 5 commits intonextfrom
feat/v4-nth-variant
Jun 3, 2024
Merged

Add nth-* variants#13661
thecrypticace merged 5 commits intonextfrom
feat/v4-nth-variant

Conversation

@thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented May 8, 2024

This adds variants for the :nth-child(), :nth-last-child(), :nth-of-type(), and :nth-last-of-type() pseudo classes. These variants support arbitrary values as well as numeric bare values. Refer to the table below for example usasges on what selectors these variants produce:

Variant Selector
nth-3:* &:nth-child(3)
nth-[2n+1]:* &:nth-child(2n+1)
nth-[2n+1_of_.item]:* &:nth-child(2n+1 of .item)
nth-last-3:* &:nth-last-child(3)
nth-last-[2n+1]:* &:nth-last-child(2n+1)
nth-last-[2n+1_of_.item]:* &:nth-last-child(2n+1 of .item)
nth-of-type-3:* &:nth-of-type(3)
nth-of-type-[2n+1]:* &:nth-of-type(2n+1)
nth-last-of-type-3:* &:nth-last-of-type(3)
nth-last-of-type-[2n+1]:* &:nth-last-of-type(2n+1)

Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

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

Only thing it doesn't really do is read from a config, but I think think that even makes sense so this is looking good to me 👍

Copy link

@SH20RAJ SH20RAJ left a comment

Choose a reason for hiding this comment

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

Nice to see this ✅

Copy link
Member

@adamwathan adamwathan left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@thecrypticace thecrypticace force-pushed the feat/v4-nth-variant branch from 80dc5d1 to 20a6c1d Compare June 3, 2024 15:37
@thecrypticace thecrypticace merged commit 1124d1d into next Jun 3, 2024
@thecrypticace thecrypticace deleted the feat/v4-nth-variant branch June 3, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants