CSS3 [attribute$=value]Selectors

Complete CSS Selector Reference Manual

Example

Set the background color of all div elements whose class attribute value ends with "test":

div[class$="test"]
{
background:#ffff00;
}

Try it Yourself »

Definition and Usage

[attribute$=value] The selector matches elements whose attribute value ends with the specified value.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers supportattribute$=value] selector.

Note: [attribute$=value]To run in IE8, must declare.<!DOCTYPE> 。


Examples

Try it Yourself - Examples


Example

Set the background color of all elements whose class attribute value ends with "test":

[class$="test"]
{
background:#ffff00;
}

Try it Yourself »


Complete CSS Selector Reference Manual

other extensions