一、基本选择器
1.ID选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>选择器</title>
<style type="text/css">
id选择器
#one{
color: blue;
}
<body>
<p id="one">这是一段话</p>
</body>
2.类选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>选择器</title>
<style type="text/css">
类选择器
.two{
color: green;
}
<body>
<div class="two">这是一个div</div>
</body>
3.标签选择器
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>选择器</title>
<style type="text/css">
标签选择器
h2{
color: red;
}
<body>
<h1>这是一个标题