-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
72 lines (63 loc) · 3.73 KB
/
Copy pathindex.html
File metadata and controls
72 lines (63 loc) · 3.73 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
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="A retro-styled calculator built with vanilla JavaScript and CSS3. Full keyboard support, calculation history, memory keys and operator precedence." />
<title>CSS3 Calculator</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@700&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<main class="calc" role="application" aria-label="Calculator">
<div class="calc__frame">
<header class="calc__topbar">
<span class="calc__brand">CSS3 Calc</span>
<button type="button" class="calc__theme" id="themeToggle" aria-label="Toggle light and dark theme" title="Toggle theme">☀</button>
</header>
<div class="calc__screen">
<output class="calc__expression" id="expression" aria-live="off"></output>
<output class="calc__display" id="display" aria-live="polite">0</output>
<span class="calc__memory-flag" id="memoryFlag" aria-hidden="true">M</span>
</div>
<div class="calc__keys">
<button type="button" class="key key--mem" data-action="mc" title="Memory clear">MC</button>
<button type="button" class="key key--mem" data-action="mr" title="Memory recall">MR</button>
<button type="button" class="key key--mem" data-action="m-plus" title="Memory add">M+</button>
<button type="button" class="key key--mem" data-action="m-minus" title="Memory subtract">M−</button>
<button type="button" class="key key--fn" data-action="clear" title="Clear (Esc)">C</button>
<button type="button" class="key key--fn" data-action="negate" title="Plus / minus">±</button>
<button type="button" class="key key--fn" data-action="percent" title="Percent">%</button>
<button type="button" class="key key--op" data-op="/" title="Divide">÷</button>
<button type="button" class="key key--num" data-digit="7">7</button>
<button type="button" class="key key--num" data-digit="8">8</button>
<button type="button" class="key key--num" data-digit="9">9</button>
<button type="button" class="key key--op" data-op="*" title="Multiply">×</button>
<button type="button" class="key key--num" data-digit="4">4</button>
<button type="button" class="key key--num" data-digit="5">5</button>
<button type="button" class="key key--num" data-digit="6">6</button>
<button type="button" class="key key--op" data-op="-" title="Subtract">−</button>
<button type="button" class="key key--num" data-digit="1">1</button>
<button type="button" class="key key--num" data-digit="2">2</button>
<button type="button" class="key key--num" data-digit="3">3</button>
<button type="button" class="key key--op" data-op="+" title="Add">+</button>
<button type="button" class="key key--fn" data-action="backspace" title="Backspace">⌫</button>
<button type="button" class="key key--num" data-digit="0">0</button>
<button type="button" class="key key--num" data-action="decimal">.</button>
<button type="button" class="key key--eq" data-action="equals" title="Equals (Enter)">=</button>
</div>
</div>
<aside class="calc__history" aria-label="Calculation history">
<div class="calc__history-head">
<span>History</span>
<button type="button" class="calc__history-clear" id="clearHistory">Clear</button>
</div>
<ul class="calc__history-list" id="historyList"></ul>
<p class="calc__history-empty" id="historyEmpty">No calculations yet.</p>
</aside>
</main>
<script src="js/calculator.js"></script>
</body>
</html>