Skip to content

Instantly share code, notes, and snippets.

@juanpasolano
Last active December 12, 2015 12:19
Show Gist options
  • Save juanpasolano/4770804 to your computer and use it in GitHub Desktop.
Save juanpasolano/4770804 to your computer and use it in GitHub Desktop.
CSS: attribute selectors
li[class~='red'] {} /*Selects all li that have the class red and other classes*/
li[class|='red'] {} /*Selects li that have hyphen separeted values, ie: 'red-button', 'red-external'*/
li[class*='red'] {} /*selects all li that have the a class tat has red in it ie: 'ared', 'redid', 'xxxxxred'*/
li[class^='red'] {} /*Selects all li which class starts with 'red', ie: 'redid', 'redxxx'*/
li[class$='red'] {} /*selects li which class ends with value 'red', ie: 'xxxred', 'ared'*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment