Skip to content

Instantly share code, notes, and snippets.

@cerebrl
Created July 15, 2013 01:30
Show Gist options
  • Save cerebrl/5996916 to your computer and use it in GitHub Desktop.
Save cerebrl/5996916 to your computer and use it in GitHub Desktop.
CSS Attribute Selectors
/**************************
CSS 2.1 Attribute Selectors
**************************/
E[foo] /* Matches any E element with the "foo" attribute set (whatever the value). */
E[foo="warning"] /* Matches elements whose "foo" attribute value is exactly equal to "warning".*/
E[foo~="warning"] /* Matches elements whose "foo" attribute value is a list of space-separated values, one of which is exactly equal to "warning". */
/**************************
CSS 3 Attribute Selectors
**************************/
div[id*=post] /* anything with post */
div[id^=post] /* anything begining with post */
div[id$=post] /* anything ending with post */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment