Skip to content

Instantly share code, notes, and snippets.

@cyancey76
Created September 14, 2017 16:43
Show Gist options
  • Save cyancey76/01c33ceefb06212e6aceb1369bc48cad to your computer and use it in GitHub Desktop.
Save cyancey76/01c33ceefb06212e6aceb1369bc48cad to your computer and use it in GitHub Desktop.
CSS Selectors
* // All
#Z // ID
.Z // Class
X Y // Descendant
X // Element
X:link // Pseudo-class
X + Y // Adjacent Y sibling after X
X > Y // Direct child
X ~ Y // All Y siblings after X
X[attribute] // Attribute selector
X[attribute="value"] // Attribute equals value
X[attribute*="value"] // Attribute contains value
X[attribute^="value"] // Attribute begins with value
X[attribute$="value"] // Attribute ends with value
X[data-attribute="value"] // Has data-attribute of value
X[data-attribute~="value"] // Value in space separated data-attribute list
X:checked // Element that has been checked
X:before, X:after // Before and after pseudo-elements
X:not(selector) // All elements that are not selector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment