CSS继承
在CSS世界中,有一部分属性会继承其父元素所设置的值,所以在写样式时经常出现这样的问题:我没在这个元素上写颜色呀、写字体样式呀~~~。正是因为属性继承才导致了这样的问题,知道有哪些属性才能在解决一些样式问题上得心应手。
能解决的问题
1.避免重复声明某个样式,只要在父元素上写一次就可以
2.样式叠加,能清晰知道被哪个可继承元素影响
可继承属性分类
1.字体系列:font、font-*
2.文本系列
- line-height:line-height可以继承!!!
- color
- text-align
- text-indent
- text-justify
- text-orientation
- text-rendering
- text-shadow
- text-transform
- text-underline-position
- text-combine-upright
- word-spacing
- word-break
- word-wrap
- letter-spacing
- direction
3.元素可见:visibility
4.列表属性:list-style、list-*
5.其它
- quotes
- cursor