美文网首页
结构性伪类选择器 :root :not() :empty

结构性伪类选择器 :root :not() :empty

作者: Simon_s | 来源:发表于2016-09-27 19:08 被阅读9次

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
    /root 设置页面根元素的样式/
    :root{
    background-color: brown;
    }
    p{
    height: 30px;
    background-color: blue;
    }
    /not 排除某个或某类元素/
    /* not (被排除的元素的选择器)/
    p:not(.iten3){
    background-color: blueviolet;
    }
    /
    指定的前面选择器所选的元素为空的 添加相应的样式*/
    div:empty{
    height: 100px;
    background-color: cyan;
    }
    </style>
    </head>
    <body>
    <p class="iten1"></p>
    <p class="iten2"></p>
    <p class="iten3"></p>
    <p class="iten4"></p>
    <p class="iten5"></p>
    <div></div>
    </body>
    </html>

    相关文章

      网友评论

          本文标题:结构性伪类选择器 :root :not() :empty

          本文链接:https://www.haomeiwen.com/subject/sjxhyttx.html