MSDN Library

Whitespace [~=] Attribute Selector New for Windows Internet Explorer 7

Exactly matches the specified attribute value in a space-delimited list of values.


HTML [att~=val] { sRules }
Scripting N/A

Possible Values

att Must be either an Identifier or a String.
val Must be either an Identifier or a String.
sRules String that specifies one or more Cascading Style Sheets (CSS) attribute/value pairs.


This selector is available as of Internet Explorer 7.

This property is enabled only instandards-compliant mode (strict !DOCTYPE).

Attributes are case-sensitive.

If the target val contains whitespace, the rule will not match anything.


The following style rule selects any attribute whose value contains the token "Two."

    .test         { display:none; }
    [attr~="Two"] { display:block; }

<div class="test" attr="One Two Three">Test for [~=] (Token) succeeded.</div>

This feature requires Microsoft® Internet Explorer 7 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This selector is defined in CSS, Level 2 Revision 1 (CSS2.1).

See Also

Class Selector, Equality [=] Attribute Selector, Existence [] Attribute Selector, Hyphen [|=] Attribute Selector, ID Selector, Prefix [^=] Attribute Selector, Substring [*=] Attribute Selector, Suffix [$=] Attribute Selector, Type Selector, Universal (*) Selector
© 2016 Microsoft