MailViewr - Free HTML Email Preview Tool
← CSS Support Index

Does CSS Attribute selector Work in HTML Email?

The attribute selector (`[attr]`) targets elements with this specific attribute.

Quick Answer

Does Attribute selector work in HTML email?

The CSS Attribute selector property is supported in Outlook (Mac / Web), Apple Mail, Samsung Email, Thunderbird, and others. It is NOT supported in Outlook (Windows), ProtonMail. Always include a safe fallback for unsupported clients.

Which Email Clients Support CSS Attribute selector?

CSS support for Attribute selector across email clients

Email ClientDesktopMobile / WebNotes
Gmail~ Partial~ Partial
Outlook (Windows)✗ No?
Outlook (Mac / Web)✓ Yes~ Partial
Apple Mail✓ Yes✓ Yes
Yahoo! Mail~ Partial~ Partial
Samsung Email?✓ Yes
Thunderbird✓ Yes?
ProtonMail✗ No✗ No
Fastmail✓ Yes?

Notes

  • #1 Partial. Can not be used with a class selector (`.test[class]`). Must be used solo (`[class]`) or with an element selector (`td[class]`).
  • #2 Partial. Only supports `[attr]`, `[attr=value]`, `[attr~=value]`, `[attr|=value]` syntaxes.
  • #3 Buggy. A `class="test"` in the HTML is prefixed `class="x_test"`, but an attribute selector stays unprefixed `[class="test"]`.
  • #4 Partial. Only supports `[attr=value]` syntax.
  • #5 Partial. Only supports `[attr~=value]` syntax. Only `class` as an attribute name is known to be supported.
  • #6 Partial. Doesn't work with non Google accounts.

This page reflects support for different syntaxes: `[attr]`, `[attr="value"]`, `[attr~="value"]`, `[attr|="value"]`, `[attr^="value"]`, `[attr$="value"]`, `[attr*="value"]`.

Frequently Asked Questions

Related CSS Properties

Test Your Email Now

Paste your HTML and see how it renders in clients that don't support
Attribute selector.

Open Email Previewer