Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 14: Advanced Selectors > ATTRIBUTE SELECTORS

ATTRIBUTE SELECTORS

Attribute selectors are used to apply style sheet declarations based on the presence of attributes or attribute values of an HTML element.

There are several types of attribute selectors, and CSS is capable of detecting attributes based on the following criteria:

  • The presence of an attribute
  • The value of an attribute
  • Whether the attribute value begins with a specific string
  • Whether the attribute value ends with a specific string
  • Whether the attribute value contains a specific string anywhere in the value, be it at the beginning, end, or middle

The following sections examine each type of attribute selector in greater depth and provide examples of the syntax for each.

images NOTE All major browsers except for IE 6 support attribute selectors.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial