伪类
可以用于操作dom流中已存在的节点,控制节点特定状态。
常用的伪类:
n的常见值为1,2,3,odd,even
:first-child
:last-child
:nth-child(n)
:first-of-type
:last-of-type
:nth-of-type(n)
:link
:active
:hover
:visited
:focus
:left
:right
:first
伪元素
可以创建一个dom流中不存在的元素,与已存在的某个元素存在关联。
常见伪元素:
::before
::after