Select elements by their type
Select elements by their ID
Select an element inside another element
p strong{...} => all <strong> elements within the <p> tag
.fruits li{...} => all <li> elements within the fruits class
Select elements by their class
You can combine the class selector with other selectors
ul.fruit => all ul elements with the fruit class
#post.fruit => all elements of ID post with the fruit class
You can list multiple selectors with commas
p, div, .fruit{..} => all elements with <p>, <div> tags or
the fruit class
You can select everything using *
@@@ * selects all elements within the @@@ element
.fruit *{...} => all elements within the elements with fruit tag
This selects all B elements that directly follow the A element
.fruit+li => all the <li>s that come right after the .fruit class
This selects all B elements that follow the A element
.fruit~li => all the <li>s following the .fruit class
This selects the elements of B type that are directly within A
This selects All first child elements of type B in A
This selects All the only child elements of type B in A
This selects All last child elements of type B in A
This selects the Cth child elements of type B in A
This selects the Cth child elements from the back
of type B in A
This selects the first element of type B in A
This selects the Cth element of type B in A
C can be odd or even
The C is replaced with An+B
li:nth-of-type(2n+3)
This selects the B element if it's the only B in A
This selects all the last element of type B in A
This selects all the A elements that dont have children
This selects all A that is not B
There can be multiple Bs
This selects all elements that have a certain attribute
a[href], [type]
You can have a value for the attribute
a[type="checkbox"]
You can Specify what the value starts with
a[type^="AB"]
You can Specify what the value ends with
a[type$="AB"]
You can Specify what the value contains
a[type*="AB"]