CSS Selectors Cheat Sheet

In CSS, selectors are patterns used to select the element(s) you want to style.

* {}Universal Selector
#id {}ID Selector
.class {}Class Selector
h1, h2 ,h3 {}Type Selector
h1 + p {}Adjacent Sibling Selector
ul > li {}Child Selector
h1 ~ p {}General Sibling Selector
p a {}Descendant Selector
div[attribute="SomeValue"] {}Attribute Selector

Leave a Reply

Your email address will not be published. Required fields are marked *