To get even more specific, you can target elements that have a specific value for a certain attribute. The general syntax for the Exact Attribute selector appears below.

General Syntax for the Exact Attribute Selector

element[attr="value"] { declarations... }

This selector is not supported in Windows IE 6 or below.

Let's illustrate this with an example. In the rule the follows, only images that include an ALT attribute with the value of "logo-Reader" will have a red border.

Example Style sheet

img[alt="logo-Reader"] { border: red 5px solid; }

Example Markup

<p> <img src="logo-QT.jpg" alt="logo-Quicktime" /> <img src="logo-reader.gif" alt="logo-Reader" /> <img src="logo-realPlayer.gif" alt="logo-Player" /> </p>

Rendered Example

logo-Quicktime logo-Reader logo-Player

As you can see from the markup, the Adobe Acrobat Reader® image is the only image whose ALT attribute has the "logo-Reader" value. Thus, it is the only image that has a red border.