Attribute Selectors
Attribute selectors match elements based on the presence or value of their HTML attributes. They are wrapped in square brackets and offer powerful pattern matching.
Common Patterns
| Syntax | Meaning |
|---|---|
[attr] | Element has the attribute |
[attr="val"] | Exact match |
[attr^="val"] | Starts with |
[attr$="val"] | Ends with |
[attr*="val"] | Contains |
[attr~="val"] | Word in space-separated list |
Case Insensitivity
Add i before the closing bracket to match attribute values case-insensitively: [href$=".PDF" i].