今天学习了CSS的三大特性,继承、层叠和优先级。我就直接说我的想法吧。
继承是子代可以直接使用父代的某些样式(属性),但是不是所有的样式都可以被继承,有些是不可以被继承的。
<style type="text/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。 所有元素可继承: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上面这些元素,有许多是我们学过的,有我们现在还没有学的,以后可能都会学的。
今天学习的就这么多了,可能案例没有写,以后会更新的。