前端HTML中的hover选择器

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.one{
background-color: tomato;
width: 300px;
height: 300px;
line-height:300px;
}
/*:hover 用来捕捉鼠标进入标签状态
注意: 冒号:前后不准加空格*/
.one:hover{
background-color: pink;
width: 200px;
height: 200px;
line-height:200px;
}
</style>
</head>
<body>
<div style="font-size: 50px; text-align: center;" class="one">

<hr />
</div>
</body>
</html>

运行结果:
此时鼠标不在橙色区域上

把鼠标放在橙色区域上


前端HTML中的hover选择器
http://ultracode.cn/2020/10/12/HTML/前端HTML中的hover选择器/
作者
Win
发布于
2020年10月12日
许可协议