I want to select all h2 with any id.
I've tried h2#*
which is invalid, and I've tried attribute selectors h2[id*='']
, but this won't accept a wildcard, and leaving it empty (as above, nothing between the quotes) doesn't match anything.
Is there anything I've missed, or is this just a dead-end?
You can use the attribute selector. It's not necessary to supply a value. This should select all h2
elements with an id
attribute, whether or not it has a value:
h2[id] {/* ... */}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With