標籤:
不可繼承的:
1 display、margin、border、padding、background2 height、min-height、max- height3 width、min-width、max-width、overflow4 position、left、right、top、 bottom、z-index5 float、clear、table-layout、vertical-align6 page-break-after、 page-bread-before和unicode-bidi
不可繼承:也就是指子節點不能繼承父節點的屬性
簡單舉例:
1 <div style="border: 1px solid #000;">2 父節點3 <p>這是子節點</p>4 </div>
:
如果子節點能繼承父節點的border屬性,那麼也會有一個紅色邊框。
所有元素可繼承:
visibility和cursor
內嵌元素可繼承:
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
塊狀元素可繼承:
text-indent和text-align
列表元素可繼承:
list-style、list-style-type、list-style-position、list-style-image
表格元素可繼承:
border-collapse
相反,可繼承就是父節點設定了這個屬性後,子節點就可以繼承他的屬性,
權重的比較:
標籤選取器(1)<類別選取器(10)<id選取器(100)<行內樣式<!important
因而它有更高的權重。當有多個規則都能應用於同一個元素時,權重越高的樣式將被優先採用。而繼承
屬性的特性值為0;也就是說,任何一條與css繼承值衝突的屬性值都會覆蓋繼承的屬性值!!!
css中可以和不可以繼承的屬性