CSS [attribute=value] Selector

❮ Previous Selectors Next ❯

Example

p[title="example"] { 
  background-color: red;
}

Meaning

The [attribute=value] selector select elements with the specified attribute and value.

The above example selects <p> elements with a title="example" attribute:

Version: CSS2




Standard Syntax

[attribute=value] {
  css declarations;
}



Browser Support

The numbers in the table specify the first browser version that fully supports the property.




Status







❮ Previous Selectors Next ❯