1.css偽類###
p:first-child
a:link
a:hover
a:visited
a:active
:disabled
:enable
:checked
:focus
:read-only
:read-write
2.css3新增偽類###
p:nth-child(n):父標(biāo)簽的第n個(gè)子標(biāo)簽,同時(shí)是p標(biāo)簽
p:nth-of-type(n):父標(biāo)簽的第n個(gè)p子標(biāo)簽
p:nth-last-child(n):父標(biāo)簽的倒數(shù)第n個(gè)子標(biāo)簽,同時(shí)是p標(biāo)簽
p:nth-last-of-type(n):父標(biāo)簽的倒數(shù)第n個(gè)子標(biāo)簽
p:first-child:父標(biāo)簽的第一個(gè)子標(biāo)簽,同時(shí)是p標(biāo)簽
p:last-child:父標(biāo)簽的最后一個(gè)子標(biāo)簽,同時(shí)是p標(biāo)簽
p:last-of-type:
p:first-of-type
3.偽元素###
p::before
p::after
p::first-letter
p::first-line
4.定位###
絕對(duì)定位(absolute):絕對(duì)定位脫離了文檔流,沒有獨(dú)占一行只受top,right,bottom,left的影響。
一個(gè)塊的top,right,bottom,left又相對(duì)什么呢?
1.如果父元素做了點(diǎn)位,則是相對(duì)于父元素。
2.如果父元素沒有做定位,則是相對(duì)于body。相對(duì)定位(relative):相對(duì)定位沒有脫離文檔流,只受top,right,bottom,left的影響。top,right,bottom,left則是相對(duì)于塊中最近的父元素。
固定定位(fixed):固定定位脫離了文檔流,沒有獨(dú)占一行。top,right,bottom,left是始終相對(duì)于body。
top,right,bottom,left只有在設(shè)置了定位(絕對(duì),相對(duì),固定)才起作用。