Discussion: Pseudo Selector
HTML & CSS - CSS Selectors - Lesson 23 Pseudo Selector
Pseudo selector is a bit tricky so here's an explanation on it to help you understand better.
In the pseudo selector white space makes a difference. Examples:
p:nth-child(4) /* no white space between p and : */
This will target the
p element which is a fourth child of its parent element.
p :nth-child(4) /* with white space */
This will target the fourth child (of any tag name) of a
Also note the following selector:
:nth-child(4) /* yes, this is legitimate */
This will target an element (of any tagname) that is the fourth child of its parent element. Either of the above two will work in your case.
This explanation was derived from this topic and thanks to @mtf who explained it.