CSS中可继承和不可继承属性总结

可继承属性

  • 所有元素:visibility、cursor
  • 列表元素:list-style、list-style-type、list-style-position、list-style-image
  • 字体属性:line-height、color、font、font-family、font-size、font-style、font-variant、font-weight、font-size-adjust
  • 表格布局属性:caption-side、border-collapse、border-spacing、empty-cells、table-layout
  • 文本属性:text-transform、direction
  • 其它属性:letter-spacing、word-spacing

不可继承属性

  • 盒子模型所有属性:margin、padding、border、width、height
  • 轮廓及背景属性:outline、background
  • 定位、显示、浮动属性:display、position、top、left、right、bottom、max-*(如max-height等)、min-*、overflow、clear、float、content、z-index、vertical-align
  • 文本属性:white-space
  • 其它:display

块级元素可以继承,内联元素不能继承属性

text-indent、text-align、text-decoration、text-shadow

备注:(待完善...

猜你喜欢

转载自www.cnblogs.com/uakora/p/12585187.html