-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.html
More file actions
141 lines (136 loc) · 2.18 KB
/
Copy pathsearch.html
File metadata and controls
141 lines (136 loc) · 2.18 KB
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CSS3搜索框展开收缩动画特效抄的</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #252525;
}
.container {
position: absolute;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 300px;
height: 100px;
}
.container .search {
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 25px;
height: 25px;
background: white;
border-radius: 50%;
transition: all 1s;
z-index: 4;
}
.container .search:hover {
cursor: pointer;
}
/*放大镜*/
.container .search::before {
content: "";
position: absolute;
margin: auto;
top: 13px;
right: 0;
bottom: 0;
left: 13px;
width: 5px;
height: 2px;
background: gray;
transform: rotate(45deg);
transition: all .5s;
}
.container .search::after {
content: "";
position: absolute;
margin: auto;
top: -1px;
right: 0;
bottom: 0;
left: -1px;
width: 10px;
height: 10px;
border-radius: 50%;
border: 2px solid gray;
transition: all .5s;
}
.container input {
font-family: 'Inconsolata', monospace;
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 30px;
height: 30px;
outline: none;
border: none;
background: white;
color: gray;
padding: 0 80px 0 20px;
border-radius: 30px;
transition: all 1s;
opacity: 0;
z-index: 5;
font-weight: bolder;
letter-spacing: 0.1em;
}
.container input:hover {
cursor: pointer;
}
.container input:focus {
width: 200px;
opacity: 1;
cursor: text;
}
.container input:focus ~ .search {
right: -170px;
background: gray;
z-index: 6;
}
/*X按钮*/
.container input:focus ~ .search::before {
top: 0;
left: 0px;
background: white;
width: 25px;
}
.container input:focus ~ .search::after {
top: 0;
left: 0px;
width: 25px;
height: 2px;
border: none;
background: white;
border-radius: 0%;
transform: rotate(-45deg);
}
.container input::placeholder {
color: gray;
opacity: 0.5;
font-weight: bolder;
}
</style>
</head>
<body>
<div class="container">
<input type="text" placeholder="Search...">
<div class="search"></div>
</div>
</body>
</html>