03.CSS选择器-->交集并集选择器

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>高级选择器</title>
    <style>
        /*交集选择器*/
        /*既是P标签,类名称又会text的元素字体变为红色*/
        p.text{
            color: red;
        }
        /*并集选择器*/
        /*让container下的所有元素内容为蓝色*/
        #container p,span,em,strong{
            color: blue;
        }
    </style>
</head>
<body>
    <!--交集选择器-多个选择器包含的元素-->
    <p>好好学习1</p>
    <p class="text">好好学习2</p>
    <p class="text">好好学习3</p>
    <p>好好学习4</p>

    <!--并集选择器-多个选择所有匹配的元素-->
    <div id="container">
        <p>好好学习1</p>
        <span>好好学习2</span><br>
        <em>好好学习3</em><br>
        <strong>好好学习4</strong>
    </div>

</body>
</html>

posted @ 2017-10-10 19:23  Smart.User.It  阅读(3993)  评论(0)    收藏  举报