> 文章列表 > CSS选择器有哪些?哪些属性可以继承?

CSS选择器有哪些?哪些属性可以继承?

CSS选择器有哪些?哪些属性可以继承?

选择器:通配符(通用选择器) *    id选择器 #app          类选择器 .app            标签选择器 div后代选择器  #app div      子选择器 #app>div     群组选择器 #app,.app 相邻同胞选择器    div+p (选择紧接在<div>之后的所有<p>元素)伪类选择器       :link   :visited   :active   :hover   :focus    :first-child伪元素选择器     :first-letter :first-line :before :after :lang(language)属性选择器      [attribute] [attribute=value] [attribute~=value] [attribute|=value]CSS3新增选择器如下:层次选择器	p~ul	选择前面有p元素的每个ul元素伪类选择器	: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)	属性选择器	[attribute*=value] 选择属性中包含value值的属性
[attribute~=value] 是指包含value整个单词
选择属性以value开头的所有元素  [attribute^=value] 
选择属性以value结束的所有元素  [attribute$=value]	

css继承特性主要是指文本方面的继承,盒模型相关的属性基本没有继承特性。  

不可继承的: 
display、margin、border、padding、background、height、min-height、max-height、
width、min-width、max-width、overflow、position、top、bottom、left、right、z-index、
float、clear、 table-layout、vertical-align、page-break-after、page-bread-before
和unicode-bidi所有元素可继承的: 
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 列表元素可继承的: 
list-style、list-style-type、list-style-position、list-style-image