CSS中继承性属性和非继承性的属性
不可繼承的:display、margin、border、padding、background、height、min-height、max- height、width、min-width、max-width、overflow、position、left、right、top、 bottom、z-index、float、clear、table-layout、vertical-align、page-break-after、 page-bread-before和unicode-bidi。
不可繼承:也就是指子節點不能繼承父節點的屬性,
~~~ 不可繼承屬性:盒子模型相關的(margin border padding height width min-height max-height min-width max-width) 顯示相關屬性 (display,overflow) 定位屬性(position left top right bottom z-index float clear vertical-align table-layout)譬如:
<div style="border:1px?solid?#ff0000;">這是父節點<p>這是子節點</p></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。
總結
以上是生活随笔為你收集整理的CSS中继承性属性和非继承性的属性的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 大数据专业在大学需要考什么证_大学可以考
- 下一篇: ssh访问控制,封杀ip,防止暴力破解