CSS Attribute Selectors

In an HTML document, CSS Attribute Selectors select an element using the presence of a given attribute or attribute value.

There are different types of attribute selectors which are listed below.

Example:

Title  span[id=span] { color:red; }

[id=span] { color:blue; /* Regular id attribute which works with any element */ }      Red text. Default text. Blue text.