id选择器
id选择器可以为标有id的HTML元素指定特定的样式
id选择器以“#”来定义
id选择器和派生选择器
目前比较常用的方式是id选择器常常用于建立派生选择器
id选择器使用
index.html1
2
3
4
5
6
7
8
9
10
11
12
13
14
15<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="demo.css" type="text/css" ref="stylesheet">
</head>
<body>
<p id="pid">Hello JhonRain </p>
<div id="divId">
这是一个Div
</div>
<p id="ppid">Hell JhonRain <a href="https://hongsir15.github.io/">Blog</p>
</body>
</html>
demo.css1
2
3
4
5
6
7
8
9
10
11#pid{
color:red;
}
#ppid a{
color:green;
}
#divId{
color:blue;
}
最后更新: 2018年09月26日 12:02