Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS3 [attribute$=value] selector

CSS3 [attribute$=value] selector

Complete CSS SelectorComplete 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 »


Definition and Usage

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


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support [attribute$=value] selector.

Note: [attribute$=value] must have a DOCTYPE declared to work in IE8 .


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 »


Complete CSS SelectorComplete CSS Selector Reference Manual