CSS选择符权重

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box {
        width: 500px;
        height: 400px;
        background: orange;
    }
    
    #wrap {
        widows: 1000px;
        height: 300px;
        background: red;
    }
    
    div {
        width: 100px;
        height: 100px;
        background: purple;
    }
</style>

<body>
    <div class="box" id="wrap">
        <h3 class="tit"></h3>
    </div>
</body>

</html>

 

<!-- 
    选择符权重:
        id > class > 标签

        id          100
        class       10
        标签         1

        包含选择符  为选择符权重之和(.class h3     11)
        群组选择符  权重是不变化的,保持自身权重
        伪类选择符  10
        *          权重 0
        内联样式表  1000
 -->
posted on 2021-01-04 15:00  sunandwang  阅读(133)  评论(0)    收藏  举报