选择器优先级--进阶


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>

        /*<!--行间优先级 权重值 1000-->*/
        /*<!--id选择器权重 100-->*/
        /*<!--类选择器权重 10-->*/
        /*<!--标签选择器权重 1-->*/
        /* 权重可以累加, 值越大,优先级越高 */

        /*权重计算 10 + 1 = 11 */
        .box span{
            color: red;
        }

        /*权重计算 100 + 1 = 101*/
        #box02 span{
            color: blue;
        }


    </style>


</head>
<body>


<div class="box">

    <div class="box02" id="box02" >

        <!--行间优先级 权重值 1000-->
        <span style="color: purple">
            背影--朱志清
        </span>

    </div>


</div>


</body>
</html>
发布了128 篇原创文章 · 获赞 24 · 访问量 4274

猜你喜欢

转载自blog.csdn.net/return_min/article/details/103830397
今日推荐