属性选择器

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>属性选择器</title>
        <style type="text/css">
        /* 
            属性选择器
                根据元素的属性来选中元素
                [属性名]获取含有指定属性的元素
         */
            [title]{
                width: 200px;
                height: 100px;
                background-color: #87CEEB;
            }
        </style>
    </head>
    <body>
        <p title="hello">我是一个p元素</p>
    </body>
</html>

 

posted @ 2022-05-08 18:55  氯丙嗪  阅读(9)  评论(0)    收藏  举报