13. :root
/* SELECT ROOT Document Element */
:root{
background : red;
}
/* Will select the <html> element*/
14. :first-child | :last-child
<ul>
<li>A</li> <li>B</li> <li>C</li>
</ul>
ul li : first-child { /* select first item*/
background : blue;
}
ul li : last-child { /* select last item*/
background : red;
}
15. :nth-child(N) | :nth-last-child(N)
<ul>
<li>A</li> <li>B</li> <li>C</li>
</ul>
ul li : nth-child(N/odd|even) {
background : blue;
}
ul li:nth-last-child(N/odd|even){
background : red;
}
16. :first-of-type | :last-of-type
<div>
<p>A</p> <span>B</span> <p>C</p>
</div>
div p : first-of-type { /* select first item of type p */
background : blue;
}
div p : last-of-type { /* select last item of type p*/
background : red;
}
17. :nth-of-type(N) | :nth-last-of-type(N)
<div>
<p>A</p> <span>B</span> <p>C</p>
</div>
div p : nth-of-type(N/odd|event){
background : blue;
}
div p : nth-of-type(N/odd|event){
background : red;
}
18. :only-of-type
<div>
<p>A</p> <span>B</span> <p>C</p>
</div>
/* select only one element from type span */
div span : only-of-type {
background : blue;
}
23. :first-letter | :first-line
<p> Lorem ipsum dolor si amet </p>
p : first-letter { /* change first letter of text style*/
font-size : 25px;
font-weight : bold
}
p : firs-line { /* change first line of text style*/
text-decoration : underline
}