-
Notifications
You must be signed in to change notification settings - Fork 0
/
button.html
160 lines (154 loc) · 3.46 KB
/
button.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>幽灵按钮</title>
<link rel="icon" type="image/x-icon" href="./animate.png">
<style type="text/css">
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
text-align: center;
}
body {
background-color: #333;
}
.btn_box {
position: relative;
margin: 50px auto;
}
.btn_box>.button {
position: relative;
padding: 10px 80px 10px 20px;
text-decoration: none;
border: 2px solid rgba(255, 255, 255, .5);
font-family: fantasy;
font-size: 16px;
color: #2dcb70;
transition: all .3s ease-out;
}
.button>.icon {
display: block;
position: absolute;
right: 25px;
top: 50%;
font-size: 18px;
transform: translate3d(0, -45%, 0);
transition: all .3s ease-out;
}
.button>.line {
display: block;
position: absolute;
background: rgba(255, 255, 255, 0);
transition: all .3s ease;
}
.line_top {
width: 5px;
height: 2px;
top: -2px;
left: -100%;
}
.line_right {
width: 2px;
height: 5px;
top: -100%;
right: -2px;
}
.line_bottom {
width: 5px;
height: 2px;
bottom: -2px;
right: -100%;
}
.line_left {
width: 2px;
height: 5px;
bottom: -100%;
left: -2px;
}
/** 鼠标划过动画设置 **/
.btn_box>.button:hover {
border: 2px solid rgba(255, 255, 255, 1)
}
.btn_box>.button:hover>.icon {
right: 8px;
}
.btn_box>.button:hover>.line {
background: rgba(255, 255, 255, 1);
}
.btn_box>.button:hover>.line_top {
width: 100%;
left: 0px;
}
.btn_box>.button:hover>.line_right {
height: 100%;
top: 0px;
}
.btn_box>.button:hover>.line_bottom {
width: 100%;
right: 0px;
}
.btn_box>.button:hover>.line_left {
height: 100%;
bottom: 0px;
}
/** 提示窗体样式 **/
.tip_box {
position: absolute;
bottom: -430%;
left: 50%;
transform: translate3d(-50%, 0, 0);
padding: 4px 14px;
background: #2dcb70;
border-radius: 2px;
opacity: 0;
transition: all .3s ease;
}
.tip_box:before {
display: inline-block;
position: absolute;
content: '';
width: 0;
height: 0;
border: 10px solid transparent;
top: -55%;
left: 50%;
transform: translate3d(-50%, 0, 0);
border-bottom-color: #2dcb70;
}
.tip_box>em {
font-style: normal;
font-size: 14px;
color: #fff;
}
/** tip窗体动画 **/
.btn_box>.button:hover~.tip_box {
opacity: 1;
bottom: -215%;
}
</style>
</head>
<body>
<!-- 绿色:#2dcb70 -->
<div class="btn_box">
<a href="#" class="button btn_play" data="My button is Play">
<span class="line line_top"></span>
<span class="line line_right"></span>
<span class="line line_bottom"></span>
<span class="line line_left"></span>
Play
<span class="icon">➤</span>
</a>
<!-- 提示窗体 -->
<div class="tip_box">
<em>My button is Play</em>
</div>
</div>
</body>
</html>