Why use an attribute selector to match classes?
The obvious use case for attribute selector: Specific matches
Exact match =
, containing/substring *=
, prefix ^=
, suffix $=
, etc.
Yahoo Mail Hack
- You want to support beta versions of Yahoo Mail
- You have media queries
Normally apps made before media queries just ignore the whole block - not beta yahoo mail, which just applies all the styles ignoring the media query. It doesn't support attribute selectors though...
For this case you can use attribute selectors to select a class within a media query so that the media query works on most email clients but doesn't trigger media query styles on beta versions of yahoo mail.
read more here
Caniemail data on the attribute-selector having much less support than the class selector.