Skip to content

Instantly share code, notes, and snippets.

@shanecarmody
Last active June 14, 2017 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shanecarmody/53a62e12769cadc7e93a647418b011e6 to your computer and use it in GitHub Desktop.
Save shanecarmody/53a62e12769cadc7e93a647418b011e6 to your computer and use it in GitHub Desktop.
CSS attribute selectors with special symbols/characters
Example Classification Explanation
a[href*="login"] Attribute Contains Selector Selects an element if the given attribute value contains at least once instance of the value stated
a[href^="https://"] Attribute Begins With Selector Selects an element if the given attribute value begins with the value stated
a[href$=".pdf"] Attribute Ends With Selector Selects an element if the given attribute value ends with the value stated
a[rel~="tag"] Attribute Spaced Selector Selects an element if the given attribute value is whitespace-separated with one word being exactly as stated
a[lang|="en"] Attribute Hyphenated Selector Selects an element if the given attribute value is hyphen-separated and begins with the word stated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment