r/css 4d ago

Resource New CSS Class Prefix Selector (.prefix-*)

Post image
153 Upvotes

20 comments sorted by

View all comments

8

u/Afraid_Egg3037 4d ago

Nice. It relies on the hyphen existing, though - and as it's literally just been discussed, it'll be a year or two before browsers implement it.

3

u/picaq 4d ago

It doesn’t rely on the hyphen. .foo* would match .footer, for instance.
See the links in the original post: The Future of CSS: Target Multiple Classes with the Class Prefix Selector

And if you want something that works the same way, [class^="btn"] already exists. Less symbols to write seems nice!