-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
155 lines (133 loc) · 3.37 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>better-select | progressively enhanced select auto-complete</title>
<link href="https://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-size: 16px;
font-family: Inconsolata, Fira Mono, Fira Code, monospace;
background: snow;
display: flex;
flex-direction: column;
min-height: 100vh;
}
header,
footer {
padding: 2em;
}
header {
max-width: 30em;
margin: 0 auto;
}
header h1 {
margin-bottom: 1em;
font-size: 3em;
border-bottom: 0.1em dashed;
}
header > h2 {
font-weight: normal;
}
form {
max-width: 30em;
margin: 1em auto;
padding: 2em;
background: #fff;
border: 0.5em solid;
}
form > h2 {
border-bottom: 2px dashed;
font-size: 1.8em;
padding: 0.2em 0;
margin-bottom: 1em;
}
form > div {
display: flex;
align-items: center;
margin-top: 1em;
justify-content: space-between;
}
better-select select,
input,
label,
button {
width: 100%;
font: inherit;
padding: 0.5em;
background: transparent;
}
better-select select,
input {
border: 2px solid #718096;
}
label {
padding: 0;
font-weight: bold;
max-width: 15ch;
font-size: large;
}
input {
max-width: 5ch;
}
footer,
button {
margin-top: 1em;
padding: 1em;
font-size: large;
border: none;
background: #000;
color: gold;
}
footer {
margin-top: auto;
border-bottom: 0.2em solid gold;
text-align: right;
}
footer a {
color: gold;
}
</style>
</head>
<body>
<header>
<h1>better-select</h1>
<h2>
A progressively enhanced, lightweight, customizable, and accessible
<code><select></code> custom element with an auto-complete using
text input.
</h2>
</header>
<form action="">
<h2>Buy your favorite fruits</h2>
<div>
<label for="fruit">Favorite fruit</label>
<better-select>
<select id="fruit" name="fruit" required>
<option value="">Select</option>
<option value="apple">Apple</option>
<option value="banana">Banana</option>
<option value="orange">Orange</option>
<option value="strawberry">Strawberries</option>
</select>
</better-select>
</div>
<div>
<label for="amount">Quantity</label>
<input type="text" id="amount" name="amount" pattern="\d+" inputmode="numeric">
</div>
<button>Submit</button>
</form>
<footer>
Made by <a href="https://sidvishnoi.github.io/">Sid Vishnoi</a>.
Source and documentation at <a href="http://github.com/sidvishnoi/better-select">GitHub</a>.
</footer>
<script src="https://unpkg.com/better-select/better-select.js" type="module"></script>
</body>
</html>