1<!doctype html>
2<html lang="en">
3<head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <title>Unit Converter</title>
7 <link rel="stylesheet" href="style.css">
8</head>
9<body>
10 <main class="app" aria-labelledby="title">
11 <header>
12 <p class="eyebrow">Static web app</p>
13 <h1 id="title">Unit Converter</h1>
14 <p class="lede">Instant two-way conversion for length, mass, temperature, data size, and time.</p>
15 </header>
16
17 <section class="panel" aria-label="Converter controls">
18 <label class="field wide" for="category">
19 <span>Category</span>
20 <select id="category"></select>
21 </label>
22
23 <div class="converter-grid">
24 <label class="field" for="fromValue">
25 <span>From value</span>
26 <input id="fromValue" type="text" inputmode="decimal" autocomplete="off" aria-describedby="shortcuts status">
27 </label>
28 <label class="field" for="fromUnit">
29 <span>From unit</span>
30 <select id="fromUnit"></select>
31 </label>
32
33 <button id="swap" class="swap" type="button" aria-label="Swap units and values" title="Swap (Ctrl/⌘+S)">⇄</button>
34
35 <label class="field" for="toValue">
36 <span>To value</span>
37 <input id="toValue" type="text" inputmode="decimal" autocomplete="off">
38 </label>
39 <label class="field" for="toUnit">
40 <span>To unit</span>
41 <select id="toUnit"></select>
42 </label>
43 </div>
44
45 <label class="field precision" for="precision">
46 <span>Precision</span>
47 <select id="precision">
48 <option value="0">0 decimals</option>
49 <option value="1">1 decimal</option>
50 <option value="2" selected>2 decimals</option>
51 <option value="3">3 decimals</option>
52 <option value="4">4 decimals</option>
53 <option value="6">6 decimals</option>
54 <option value="8">8 decimals</option>
55 </select>
56 </label>
57
58 <p id="status" class="status" role="status" aria-live="polite"></p>
59 <p id="shortcuts" class="shortcuts">Keyboard: Tab through controls, Ctrl/⌘+K focuses input, Ctrl/⌘+S swaps.</p>
60 </section>
61
62 <section class="panel recent-panel" aria-labelledby="recent-title">
63 <div class="recent-head">
64 <h2 id="recent-title">Recent conversions</h2>
65 <button id="clearRecent" type="button">Clear</button>
66 </div>
67 <ol id="recent" class="recent"></ol>
68 </section>
69 </main>
70 <script src="convert.js"></script>
71</body>
72</html>
73
Discussion
No comments yet. Start the discussion. Recorded by @patrick-toulme.