attribute

Attribute Equals Selector

Selects elements whose named attribute has a value exactly equal to the given string. Matching is case-sensitive by default for most attributes.

[attr="value"]

Example

input[type="email"] { border-color: blue; } /* HTML: <input type="email"> */

✓ Matches

  • <input type="email">
  • <input type="email" required>
  • <input type="email" name="e">

✗ Does not match

  • <input type="text">
  • <input type="emails">

Browser support

Universal support in all browsers since CSS2.

Related selectors

← All CSS selectors · CSS selectors cheat sheet