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

CSS [attribute=value] selector

CSS [attribute=value] selector

Complete CSS SelectorComplete CSS Selector Reference Manual

Example

Select all a elements that use target="_blank"

a[target=_blank]

{

background-color:yellow;

}

Try it »


[attribute=valueThe ] selector is used to select elements with a specified attribute and value.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support [attribute=value] selector.

Note: [attribute=value] To work in IE8, a DOCTYPE must be declared


Related Articles

CSS Tutorial: CSS attribute selectors


Complete CSS SelectorComplete CSS Selector Reference Manual