css入门基础选择器

css基础选择器

1 标签选择器
概念:
使用HTML标签名字作为选择器

2 类选择器
.类名{
属性1:属性值1;
属性2:属性值2;
属性3:属性值3;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .red{
     
     
            color: red;
            font-size: 100px;
        }
        .green{
     
     
            color: green;
            font-size: 100px;
        }
        .blue{
     
     
            color: blue;
            font-size: 100px;
        }
    </style>
</head>
<body>
    <span class="red">a</span>
    <span class="green">b</span>
    <span class="blue">c</span>
</body>
</html>

在这里插入图片描述
3 id选择器
id选择器使用 #进行标识、后面紧跟id名

基本语法格式:
#id选择器
#id名字 {属性1:属性值1;属性2:属性值2; 属性3:属性值3;}
标签

 `<p id="id 名  "></p>

猜你喜欢

转载自blog.csdn.net/GengFuGuo/article/details/108549714
今日推荐