Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS method to select all elements with any id

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?

like image 452
nHaskins Avatar asked Mar 31 '14 18:03

nHaskins


1 Answers

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] {/* ... */}
like image 123
rgthree Avatar answered Oct 25 '22 01:10

rgthree