-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
159 lines (142 loc) · 3.91 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
/* basic styling */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
width: 100%;
height: 100%;
}
/* enter everything , body basic styling */
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #111;
font-family: "Ubuntu", sans-serif;
}
/* css for searchbar field */
.searchfield {
font-weight: 600;
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 50px;
height: 50px;
outline: none;
border: none;
background: #fff;
color: #111;
text-shadow: 0 0 10px #ccc;
padding: 0 80px 0 20px;
border-radius: 30px;
box-shadow: 12px 13px 25px 0 #111, 8px 9px 25px 0 rgba(0, 0, 0, 0.2);
transition: all 1s;
opacity: 0;
z-index: 5;
font-weight: bolder;
letter-spacing: 0.1em;
}
/* pointer cursor on searchfield hover */
.searchfield:hover {
cursor: pointer;
}
/* css for search icon and cancel icon */
.search {
position: absolute;
margin: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 50px;
height: 50px;
background: #fff;
border-radius: 50%;
transition: all 1s;
z-index: 4;
}
/* pointer cursor on search , cancel icon hover */
.search:hover {
cursor: pointer;
}
/* search icon */
.search::before {
content: "";
position: absolute;
margin: auto;
top: 10px;
right: 8px;
bottom: -5px;
left: 22px;
width: 12px;
height: 2px;
background-color: #111;
transform: rotate(45deg);
}
.search::after {
content: "";
position: absolute;
margin: auto;
top: -5px;
right: 0;
bottom: 0;
left: -5px;
width: 15px;
height: 15px;
border-radius: 50%;
border: 2px solid #111;
}
/* expand width of searchfield on focus */
.searchfield:focus {
width: 300px;
opacity: 1;
cursor: text;
}
.searchfield:focus~.search {
right: -240px;
background: transparent;
z-index: 6;
}
/* css for cancel icon */
.searchfield:focus~.search::before {
top: 28px;
left: 15px;
width: 25px;
height: 2px;
bottom: 25px;
}
.searchfield:focus~.search::after {
top: 29px;
left: -8px;
width: 25px;
right: -15px;
height: 2px;
border: none;
bottom: 25px;
background: #111;
border-radius: 0%;
transform: rotate(-45deg);
}
</style>
</head>
<body>
<!-- markup of search bar -->
<input type="text" class="searchfield" />
<div class="search"></div>
</body>
</html>