Hyphen [|=] attribute selector
Matches any attribute value that is exactly equal, or optionally, followed by a hyphen.
![]() |
Syntax
[att|=val]
{...}
Parameters
- att
-
Must be either an Identifier or a String.
- val
-
Must be either an Identifier or a String.
Standards information
- CSS 2.1, Section 5.8.1
Remarks
The hyphen is used primarily as a delimiter for language codes.
Attributes are case-sensitive.
Examples
The following style rule selects any element with an "attr" attribute whose value begins with "en" and is immediately followed by a hyphen.
<!DOCTYPE html> <html> <head> <style type="text/css"> .test { display:none; } [attr|="en"] { display:block; } </style> </head> <body> <div class="test" attr="en-us">Test for [|=] (Hyphen) succeeded.</div> </body>
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/css/attr_selectors.htm
