<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>层叠性</title>
<style type="text/css">
/*2 0 1*/
#box1 #box2 p {
color: blueviolet;
}
/*1 1 1*/
#box2 .wrap3 p {
color: yellow;
}
/*1 0 3*/
div div #box3 p {
color: darkmagenta;
}
/*0 3 4*/
div.wrap1 div.wrap2 div.wrap3 p {
color: blue;
}
/*1 0 0*/
#box {
color: red;
}
/*0 1 0*/
.container {
color: green;
}
/*0 0 1*/
p {
color: fuchsia;
}
</style>
</head>
<body>
<!--层叠性:权重大的标签覆盖掉了权重小的标签,说白了,就是被干掉了
权重:谁的权重大,浏览器就会显示谁的权重
谁的权重大,数数
id的数量 class的数量 标签的数量
-->
<p id="box" class="container">猜猜我是什么颜色</p>
<div id="box1" class="wrap1">
<div id="box2" class="wrap2">
<div id="box3" class="wrap3">
<p>再来猜猜我是什么颜色</p>
</div>
</div>
</div>
</body>
</html>