-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
131 lines (119 loc) · 2.53 KB
/
test.html
File metadata and controls
131 lines (119 loc) · 2.53 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test page</title>
</head>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>test page</title>
<style>
body{
margin: 0;
padding: 0;
font-family: "Montserrat";
}
.searchbox{
width: 90%;
margin: 10px auto;
}
.header{
background: #ECDFBF;
overflow: hidden;
padding: 20px;
text-align: center;
}
.header h1{
text-transform: uppercase;
color: white;
margin: 0;
margin-bottom: 8px;
}
#value{
border: none;
background: #E0D3B6;
padding: 6px;
font-size: 18px;
width: 80%;
border-radius: 6px;
color: white;
}
#value:focus{
outline: none;
}
.container{
background: #FFFFF5;
padding: 1%;
}
.item{
margin: 3% 0px;
display: flex;
align-items: center;
}
.icon{
width: 25px;
height: 25px;
background: #E0D3B6;
color: white;
font-size: 15px;
text-align: center;
line-height: 25px;
border-radius: 50%;
margin-right: 8px;
}
.name{
font-size: 17px;
font-weight: 470;
color: #333;
}
</style>
</head>
<body>
<div class="searchbox">
<div class="header">
<h1>Search</h1>
<input onkeyup="filter()" type="text" id="value" placeholder="Type to Search">
</div>
<div class="container">
<div class="item">
<span class="icon">A</span>
<span class="name">Apple</span>
</div>
<div class="item">
<span class="icon">O</span>
<span class="name">Orange</span>
</div>
<div class="item">
<span class="icon">M</span>
<span class="name">Mandarin</span>
</div>
<div class="item">
<span class="icon">S</span>
<span class="name">Strawberry</span>
</div>
<div class="item">
<span class="icon">W</span>
<span class="name">Watermelon</span>
</div>
</div>
</div>
<script type="text/javascript">
function filter(){
var value, name, item, i;
value = document.getElementById("value").value.toUpperCase();
item = document.getElementsByClassName("item");
for(i=0;i<item.length;i++){
name = item[i].getElementsByClassName("name");
if(name[0].innerHTML.toUpperCase().indexOf(value) > -1){
item[i].style.display = "flex";
}else{
item[i].style.display = "none";
}
}
}
</script>
</body>
</html>
</html>