Tuesday, January 24, 2012

Attribute selectors

element[foo="bar"]
•attribute beginning matches exactly
element[foo^="bar"]
The element has an attribute called foo that begins with "bar" e.g.
element[foo$="bar"]
•attribute ending matches exactly
The element has an attribute called foo that ends with "bar" e.g.
element[foo*="bar"]
•attribute contains the match
The element has an attribute called foo that contains the string "bar" e.g. Examples:
a[href^="ftp:"] { ... }
a[href$=".edu"] { ... }
img[src*="photos"] { ... }

No comments:

Post a Comment