Existence attribute selector

Matches the property, whatever its value.

Syntax

[attr] { sRules }

Possible values

attr

Either an identifier or a string.

sRules

A string that specifies one or more cascading style sheet property/value pairs.

Remarks

Property selectors are enabled only in standards-compliant mode (strict !DOCTYPE).

Attributes are case-sensitive.

Example

The following style rule selects elements that use the special property:

<style>
    .test     {display: none;}
    [special] {display: block;}
</style>

<div class="test" special>Test for [] (Existence) succeeded.</div>

Standards information

This selector is defined in Cascading Style Sheets (CSS), Level 3 (CSS3) Ee371271.xtlink_newWindow(en-us,Expression.40).png.

See also

Concepts

Understanding selectors
Class selector
Equality attribute selector
Hyphen attribute selector
ID selector
Prefix attribute selector
Substring attribute selector
Suffix attribute selector
Type selector
Universal selector
Whitespace attribute selector

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.