# 纯css实现图片悬停时显示渐变圆形信息浮层
# 快速导航
# 示例效果
# 示例代码
示例代码
<template>
<div class="example-hovercircle">
<div class="overlay">
<span>itclanCoder</span>
</div>
</div>
</template>
<style scoped>
.example-hovercircle {
position: relative;
margin: auto;
width: 200px;
height: 200px;
background: url('https://coder.itclan.net/images/itclancoder.jpeg');
background-size: cover;
background-position: center;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
overflow: hidden;
cursor: pointer;
}
.example-hovercircle .overlay {
background: rgba(0, 0, 0, .5);
position: absolute;
margin: auto;
width: 0px;
height: 0px;
top: 0;
right: 0;
bottom: 0;
left: 0;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
opacity: 0;
-webkit-transition: 0.3s ease;
transition: 0.3s ease;
}
.example-hovercircle:hover .overlay {
opacity: 1;
width: 100%;
height: 100%;
}
.overlay span {
color: #fff;
font-family: 'Open Sans', sans-serif;
text-align: center;
position: absolute;
margin: auto;
width: 160px;
height: 30px;
left: 0;
top: 0;
right: 0;
bottom: 0;
opacity: 0;
}
.example-hovercircle:hover .overlay span {
opacity: 1;
-webkit-transition: 1.3s ease;
transition: 1.3s ease;
}
</style>
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
分享
留言
解答
收藏