Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Suffix [$=] attribute selector

Matches the specified suffix of an attribute value.

Selectors Level 3, Section 6.3



[att$=val] {...}



Must be either an Identifier or a String.


Must be either an Identifier or a String.

Standards information


Note  Requires Windows Internet Explorer 7 or later.
Note  Attribute selectors are not supported in webpages that are displayed in the Microsoft Internet Explorer 5 document mode (also known as "Quirks" mode). To use attribute selectors, add a !DOCTYPE directive that specifies a standard-based document. For more information, see Defining Document Compatibility.

Attributes are case-sensitive.


The following style rule selects any element with an "attr" attribute whose value ends with "n".

<!DOCTYPE html>
    <style type="text/css">
      .test        { display:none; }
      [attr$="n"]  { display:block; }
    <div class="test" attr="Green">Test for [$=] (Suffix) succeeded.</div>

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/css/attr_selectors.htm



© 2015 Microsoft