Matches any property value that is defined with a hyphen-separated list of words when the first word is exactly equal to the value specified in the rule. This selector is generally only used to apply rules for language variants.
Syntax
[attr|=val] {sRules }
Possible values
attr | Either an identifier or a string. |
val | Either an identifier or a string. |
sRules | One or more cascading style sheet property/value pairs. |
Remarks
Property selectors are enabled only in standards-compliant mode (strict !DOCTYPE).
The hyphen is used primarily as a delimiter for language codes.
Attributes are case-sensitive.
Example
The following style rule selects any property whose value begins with "en" and is immediately followed by a hyphen:
![]() | |
---|---|
<style> .test {display: none;} [attr|="en"] {display: block;} </style> <div class="test" attr="en-us">Test for [|=] (Hyphen) succeeded.</div> |
Standards information
This selector is defined in Cascading Style Sheets (CSS), Level 2, Revision 1 (CSS2.1).