Web全栈-选择器练习

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择器练习</title>
    <style>
        /*标签选择器
        p{
            color: red;
        }
        */
        /*id选择器
        #identity1{
            color: red;
        }
        #identity2{
            color: red;
        }
        */
        /*类选择器
        .para{
            color: red;
        }
        */
        /*后代选择器
        div p{
            color: red;
        }
        */
        /*子元素选择器
        div>p{
            color: red;
        }
        */
        /*交集选择器
        p.para{
            color: red;
        }
        */
        /*并集选择器
        #identity1,#identity2{
            color: red;
        }
        */
        /*通用兄弟选择器
        h1~p{
            color: red;
        }
        */
        /*序选择器
        p:nth-of-type(n+1){
            color: red;
        }
        */
        /*属性选择器*/
        p[id]{
            color: red;
            font-size: 10px;
            text-decoration: underline;
        }
    </style>
</head>
<body>

<div>
    <h1>我是标题</h1>
    <p id="identity1" class="para">我是段落1</p>
    <p id="identity2" class="para">我是段落2</p>
</div>

</body>
</html>
posted @ 2019-10-14 14:01  yindanny  阅读(355)  评论(0编辑  收藏  举报