html
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
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculadora Futurista</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="calculator">
<div class="display" id="display">0</div>
<div class="buttons">
<button onclick="clearDisplay()">C</button>
<button onclick="deleteChar()">←</button>
<button onclick="appendChar('/')">/</button>
<button onclick="appendChar('*')">*</button>
<button onclick="appendChar('7')">7</button>
<button onclick="appendChar('8')">8</button>
<button onclick="appendChar('9')">9</button>
<button onclick="appendChar('-')">-</button>
<button onclick="appendChar('4')">4</button>
<button onclick="appendChar('5')">5</button>
<button onclick="appendChar('6')">6</button>
<button onclick="appendChar('+')">+</button>
<button onclick="appendChar('1')">1</button>
<button onclick="appendChar('2')">2</button>
<button onclick="appendChar('3')">3</button>
<button onclick="calculate()" class="equals">=</button>
Enter to Rename, Shift+Enter to Preview
css
css
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
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(45deg, #1f1c2c, #928dab);
margin: 0;
font-family: 'Orbitron', sans-serif;
}
.calculator {
background: rgba(255, 255, 255, 0.1);
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
padding: 20px;
text-align: center;
}
.display {
background: rgba(0, 0, 0, 0.8);
color: #00ff00;
font-size: 2em;
padding: 10px;
border-radius: 5px;
margin-bottom: 20px;
}
.buttons {
Enter to Rename, Shift+Enter to Preview
js
js
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
function clearDisplay() {
document.getElementById('display').innerText = '0';
}
function deleteChar() {
const display = document.getElementById('display');
display.innerText = display.innerText.slice(0, -1) || '0';
}
function appendChar(char) {
const display = document.getElementById('display');
if (display.innerText === '0') {
display.innerText = char;
} else {
display.innerText += char;
}
}
function calculate() {
const display = document.getElementById('display');
try {
display.innerText = eval(display.innerText);
} catch {
display.innerText = 'Erro';
}
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Запуск