Wildcards In CSS 0 ▲ remy sharp's b:log 1 hour ago · Tech · hide · 0 comments Just a brainfart here, but it's odd that even though we have wildcard selectors throughout CSS, and even partial selectors (I'll explain in a bit) we don't have partial wildcard selectors on top level elements. I'm not talking about the "star" rule, but what I imagine would be a wildcard on elements selector. Existing methods If I want to select and style all the .btn-* classes using attribute selector, I'd do this: [class^="btn-" i] { … } This selector says: find all the elements with the class attribute that starts with "btn-" - case insensitive. It's rather brittle, because it requires that the HTML class attribute starts exactly with btn-. Though it works, it does tie the HTML closely to the CSS - which I'd argue you'd want to be very sure you need to do. But it is possible. Equally, and a lot more robust, is the wildcard that says "anywhere in the attribute", so: [class*="btn"] { … } It's fine, but it's a bit sledgehammery. However, if you want to do the same thing for a web… No comments yet. Log in to reply on the Fediverse. Comments will appear here.