Selecting elements by data * attribute in CSS

I am sure this is not possible. But how can I target all items with a data attribute.

tr[data-*] //target all data's 
+8
css css3
source share
1 answer

Neither docs on attribute selectors , or docs on data attributes gives any example or key to such a function.

Instead, it declares that the attribute selector consists of

[attr = value]

[Attr] Represents an element with the attribute name attr.

With options for comparing comparisons (for example, "starts with", "ends with", etc.), but only for value, never for the name attr .

So, if your goal is to add a custom cursor to each data-something element, you will need a different approach, perhaps providing them with specific classes.

0
source share

All Articles