Export (0) Print
Expand All
2 out of 10 rated this helpful - Rate this topic

Equality [=] attribute selector

Exactly matches the specified attribute value.

CSS 2.1

Syntax

[att=val] {...}

Parameters

att

An attribute name.

val

Must be either an Identifier or a String.

Standards information

Remarks

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.

Examples

The following style rule selects any element with an "attr" attribute (set to any value).


<!DOCTYPE html>
<html>
  <head>
    <style type="text/css">
      .test  	  { display:none; }
      [attr="Value"] {display: block;}
    </style>
  </head>
  <body>
    <div class="test" attr="Value">Test for [=] (Equality) succeeded.</div>
  </body>
</html>

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

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.