Substring attribute selector

Matches the specified substring of a property value.

Syntax

[attr*=val] {sRules}

Possible values

attr

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 sheet property/value pairs.

Remarks

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

Attributes are case-sensitive.

Example

The following style rule selects any property that contains the character string "ai":

<style>
    .test        {display: none;}
    [attr*="ai"] {display: block;}
</style>

<div class="test" attr="Contains">Test for [*=] (Substring) succeeded.</div>

Standards information

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

See also

Concepts

Understanding selectors
Class selector
Equality attribute selector
Existence attribute selector
Hyphen attribute selector
ID selector
Prefix 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.