1、标签名选择器
2、class选择器
3、id选择器
只有一个,唯一一个
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>三种基本选择器</title>
<style >
/*标签名选择器*/
div{
width: 100px;
height: 100px;
background: red;
margin-bottom: 20px;
}
/*class选择器*/
.ok{
background-color: green;
}
/*id选择器*/
#yes{
background-color: black;
}
</style>
</head>
<body>
<div id="yes"></div>
<div class="ok"></div>
<div class="ok"></div>
</body>
</html>
4、优先级
id>class>标签名