CSS [attribute] Selector

❮ Previous Selectors Next ❯

Example

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

Meaning

The [attribute] selector select elements with the specified attribute.

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

Version: CSS2




Standard Syntax

[attribute] {
  css declarations;
}



Browser Support

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




Status







❮ Previous Selectors Next ❯