css選擇符類型:
1、通用選擇器:*
2、類別選擇器:.class
3、id選擇器:#id
4、標籤選擇器:p
5、後代選擇器:div p
6、子選擇器:div > p
7、羣組選擇器:div , p
8、相鄰同胞選擇器:div +p
9、僞類選擇器::link :visited :active :hover :focus :first-child
10、僞元素選擇器::first-letter :first-line:before :after :lang(language)
11、屬性選擇器:[attribute] [attribute=value] [attribute~=value] [attribute|=value]
css3新增的僞類選擇器:
:first-of-type :last-of-type :only-of-type :only-child :nth-child(n)
:nth-last-of-type(n) :last-child :root :empty :target :enabled
:disabled :checked :not(selector)
CSS哪些屬性可以繼承?
css繼承特性主要是指文本方面的繼承,盒模型相關的屬性基本沒有繼承特性。
所有元素可繼承:
visibility和cursor
塊級元素可繼承
text-indent和text-align
內聯元素可繼承的:
letter-spacing、word-spacing、white-space、line-height、color、font、font-family、font-size、font-style、font-variant、font-weight、text-decoration、text-transform、direction
優先級爲!important > [ id > class > tag ]
!Important 比 內聯優先級高