1. 程式人生 > >CSS中哪些屬性可以被繼承

CSS中哪些屬性可以被繼承

CSS中哪些屬性可以被繼承

主要的有:

字型相關:line-height(行高), font-family(文字型別), font-size(文字大小), font-style(字形), font-variant(文字變化), font-weight(文字重度), font(文字)

文字相關: letter-spacing(字元間距), text-align(文字排序), text-indent(文字縮排), text-transform(文字轉化), word-spacing(單詞、字間距)

列表相關:list-style-image(列表屬性圖),  list-style-position(列表屬性方位), list-style-type(列表式), list-style(列表屬性)

還有一個比較重要的:color(顏色)

其他的還有一些不過不常見,可以不記,用到查吧。

下面是所有的可繼承的屬性(按字母排序):

azimuth, border-collapse, border-spacing,
caption-side, color, cursor, direction, elevation,
empty-cells, font-family, font-size, font-style,
font-variant, font-weight, font, letter-spacing,
line-height, list-style-image, list-style-position,
list-style-type, list-style, orphans, pitch-range,
pitch, quotes, richness, speak-header, speaknumeral,
speak-punctuation, speak, speechrate,
stress, text-align, text-indent, texttransform,
visibility, voice-family, volume, whitespace,
widows, word-spacing

注意:背景相關的屬性是不會被繼承的。