零基础CSS入门教程(6)——通配符选择器

1.任务目标

我们上几节课学习了id选择器和class选择器,那我们这一小节学习一下通配符选择器。

2.通配符选择器

我们这里说的通配符选择器也是全选选择器,这个选择器的通途一般是在,清除浏览器默认样式时候使用。

3.代码演示

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!--这个选择器 就一个* 他可以全选任何内容-->
    <style>
        *{
      
      
            color: blue;
        }
    </style>
</head>
<body>
    <p>你好啊</p>
    <p>你吃饭了吗</p>
    <p>你在干啥呢莫</p>
    <div>hhhh</div>
</body>
</html>

效果如下
在这里插入图片描述

4.小结

通配符选择器也叫全选选择器,我们一般会在清除浏览器默认格式的时候使用。

猜你喜欢

转载自blog.csdn.net/weixin_61808806/article/details/128224718