变量的继承和覆盖
- 作者: 联合国抬杠队秘书长
- 来源: 51数据库
- 2022-08-15
:root { --color: blue; } div { --color: green; } #alert { --color: red; } * { color: var(--color); } <p>I inherited blue from the root element!</p> <div>I got green set directly on me!</div> <div id='alert'> While I got red set directly on me! <p>I’m red too, because of inheritance!</p> </div>
推荐阅读