示例参考 - 常规继承
<style>
.g-pa {
font-size: 25px;
}
.pa {
color: royalblue;
}
</style>
<div class="gg-pa">
曾爷爷:我穷
<div class="g-pa">
爷爷:我要祖传font-size
<div class="pa">
爸爸:我要祖传color
<div class="me">
我:Yo
</div>
</div>
</div>
</div>
示例参考 - 任何权重的选择器均可覆盖继承样式
<style>
/*0,0,0,0*/
* {
color: tomato;
font-size: 7px;
}
.g-pa {
font-size: 25px;
}
.pa {
color: royalblue;
}
/*0,0,0,1*/
div {
/*...*/
}
</style>
<div class="gg-pa">
曾爷爷:我穷
<div class="g-pa">
爷爷:我要祖传font-size
<div class="pa">
爸爸:我要祖传color
<div class="me">
我:Yo
</div>
</div>
</div>
</div>
常见继承属性一览
azimuth
border-collapse
border-spacing
caption-side
color
cursor
direction
elevation
empty-cells
font-family
font-size
font-style
font-variant
font-weight
font
letter-spacing
line-height
list-style-image
list-style-position
list-style-type
list-style
orphans
pitch-range
pitch
quotes
richness
speak-header
speak-numeral
speak-punctuation
speak
speech-rate
stress
text-align
text-indent
text-transform
visibility
voice-family
volume
white-space
widows
word-spacing
登录后评论