<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
*{
margin: 0;padding: 0
}
#box,.box,ul.fu li{
color: red
}
</style>
</head>
<body>
<div class="box">袁垚1</div>
<div id="box">袁垚2</div>
<div class="box">袁垚3</div>
<p>廖慧英</p>
<ul class="fu">
<li>孩子1</li>
</ul>
<ul>
<li>孩子2</li>
</ul>
</body>
</html>
选择器:表示对选择对象进行css修饰 (html + css2)
常见的选择器 标签 元素 标记 选择器 id选择器 css类选择器 ,包含选择器 ,群组选择器 通配符 伪类选择器
1.标签选择器:
html标签都可以作为选择器使用 使用方法: div {} p{}
2.id选择器:
需要在标签的内部添加一个id属性 并且设置id属性值
在CSS样式中使用 #id属性值{ }
3.class 选择器(类选择器)
需要在标签内添加一个class属性 并且设置class属性值 (有多少个表示一类相同的)
在class样式表中 使用 .{属性值}
作用 :选择修饰多个,表示同一类
4. 包含选择器
使用:父级选择器 子级选择器{}
5.群组选择器 选中相同的属性
使用:选择器1,选择器2,...{}
6.通配符 :浏览器中是有默认间距的
*选中当前页面中的所有标签/选择器
固定用法*{ margin:0;
padding:0 }