用html5写一个超级计算器
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>超级计算器</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.calculator {
background: #1a1a1a;
border-radius: 20px;
padding: 20px;
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
max-width: 400px;
width: 100%;
}
.display {
background: #2d2d2d;
color: #fff;
font-size: 2em;
padding: 20px;
text-align: right;
margin-bottom: 10px;
border-radius: 10px;
min-height: 80px;
word-wrap: break-word;
overflow-wrap: break-word;
position: relative;
}
.history {
color: #888;
font-size: 0.5em;
position: absolute;
top: 5px;
right: 10px;
}
.buttons {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 10px;
}
button {
background: #3d3d3d;
color: #fff;
border: none;
padding: 25px;
font-size: 1.2em;
border-radius: 10px;
cursor: pointer;
transition: all 0.3s ease;
outline: none;
}
button:hover {
background: #4d4d4d;
transform: translateY(-2px);
}
button:active {
transform: translateY(0);
}
.operator {
background: #ff9500;
}
.operator:hover {
background: #ffb143;
}
.equals {
background: #4CAF50;
grid-column: span 2;
}
.equals:hover {
background: #5cbf60;
}
.clear {
background: #f44336;
}
.clear:hover {
background: #f66;
}
&