CSS基本选择器

1.标签选择器

   <style>
        h1{
            color: red;
        }
    </style>

更改所有标签

2.类选择器

<h1 class="a1">text</h1>
<h1 class="a1">text1</h1>
    <style>
        .a1{
            color: antiquewhite;
        }
    </style>

使用点为开头,并且可复用

3.id选择器

<h1 id="a2">text1</h1>

    <style>
        #a2{
            color: antiquewhite;
        }
    </style>

id选择器全局唯一,不可服用,并使用#开头

当同时使用三种选择器时,优先级:id选择器>类选择器>标签选择器

 

posted @ 2020-10-16 17:13  null_lii  阅读(142)  评论(0)    收藏  举报