CSS [attribute=value]Selectors

Complete CSS Selector Reference Manual

Example

Select all a elements that use target="_blank"

a[target=_blank]
{
background-color:yellow;
}

Try it Yourself »

<h2Definition and Usage

[attribute=value] selector is used to select elements that have a specified attribute and value.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers supportattribute=value] selector.

Note: [attribute=valueTo run in IE8, must declare<!DOCTYPE>


Related Articles

CSS Tutorial:CSS Attribute Selectors


Complete CSS Selector Reference Manualother extensions