css可以继承的属性
一、css不可以继承的属性
display、
margin、padding、border、
background、
width、min-width、max-width、height、min-height、max-height、
overflow、
position、top、bottom、left、right、z-index、
float、clear、table-layout、vertical-align、
page-bread-before、page-bread-after、unicode-bidi
二、所有元素都可以继承
visibility、
cursor
三、子元素可以继承
letter-spacing(字符间距)
word-spacing(单词间距)
white-space(如何处理元素内的空白)
line-height(设置行高,内联元素不可以继承,设置为行内块元素可以继承)
color、font、font-size、font-family、font-style、font-weight、font-variant(大写字母)
text-decoration(文本下划线、中划线)、text-transform(首字母大写、转大写)、direction(rtl-文本方向从右向左)
text-indent(首行缩进)、text-align(文本对齐)
四、列表元素(li)可继承
list-style、list-style-type、list-style-position、list-style-image
五、表格元素可继承
border-collapse
六、对于不可继承的属性,如果希望子元素可以保持和父元素一致,可以将该属性值设置为inherit
border: inherit;
扩展: