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;

  擴展:從 html 元素繼承 box-sizing

 

 

  

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM