非常非常非常重要!!!
1.层叠特性
如何理解层叠样式表单中的层叠的含义
h1 {
color: red;
text-align: center;
background: yellow;
color: green;
color: blue; /* 生效 */
}
2.继承性
如何理解CSS中的继承特性
(有的会继承,有 不会继承,,后续会讲解的。)
p {
color: red;
font-size: 30px;
}
<!-- span 会 Inherited from p 继承 p 标签的style -->
<p>哈哈 哈 哈哈,哈哈哈哈,哈哈哈哈哈。
<span>啦啦啦啦,啦啦啦啦,啦啦啦啦啦啦啦啦啦啦。
呵呵呵呵,呵呵呵呵,呵呵呵呵。</span>
</p>
练习例子:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>特性</title>
<style>
h1 {
color: red;
text-align: center;
background: yellow;
color: green;
color: blue; /* 生效 */
}
p {
color: red;
font-size: 30px;
}
</style>
</head>
<body>
<h1>我是再次出境的h1</h1>
<!-- span会 继承 p 标签的style Inherited from p-->
<p>哈哈 哈 哈哈,哈哈哈哈,哈哈哈哈哈。
<span>啦啦啦啦,啦啦啦啦,啦啦啦啦啦啦啦啦啦啦。
呵呵呵呵,呵呵呵呵,呵呵呵呵。</span>
</p>
</body>
</html>