美文网首页
CSS-选择器13-:not

CSS-选择器13-:not

作者: Java小工匠 | 来源:发表于2017-06-11 17:23 被阅读0次

    CSS选择器-系列文章

    1、not选择器

    :not(selector) 选择器匹配非指定元素/选择器的每个元素.

    2、效果演示

    源代码

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>css-选择器-not</title>
        <style type="text/css">
            #div:not(p){
                width: 100px;
                height: 20px;
                background: red;
            }
        </style>
    </head>
    <body>
        <div id="div">
            <p>p1</p>
            <div>p2</div>
            <p>p3</p>
            <p>p4</p>
        </div>
    </body>
    </html>
    

    运行效果:


    image.png

    CSS选择器-系列文章
    下一节 CSS 选择器14-Target

    相关文章

      网友评论

          本文标题:CSS-选择器13-:not

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