Neon Glass Calculator *{ box-sizing: border-box; margin: 0; padding: 0; } body{ font-family: "Poppins",sans-serif; background: linear-gradient(135deg, #000428, #004e92); height: 100vh; display: flex; justify-content: center; align-items: center; } .calculator{ background: rgba(255, 255, 255, 0.1); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37); backdrop-filter: blur(10px); border-radius: 20px; padding: 20px; width: 350px; max-width: 90%; } .display { background: rgba(255, 255, 255, 0.2); box-shadow: inset 0 4px 12px rgba(255, 255, 255, 0.5); color: #fff; font-size: 2.5rem; text-align: right; padding: 20px 10px; border-radius: 10px; margin-bottom: 20px; } .buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; } button { background: rgba(255, 255, 255, 0.1); border: none; box-shadow: 0 4px 15px rgba(0, 255, 255, 0.4), 0 0 10px rgba(0, 255, 255, 0.7) inset; color: #fff; font-size: 1.5rem; padding: 20px; border-radius: 12px; transition: transform 0.3s, box-shadow 0.3s; cursor: pointer; } button:active { transform: scale(0.95); box-shadow: 0 4px 25px rgba(0, 255, 255, 0.6), 0 0 15px rgba(0, 255, 255, 1) inset; } button.operator { background: rgba(255, 255, 255, 0.2); color: #00ffff; box-shadow: 0 4px 15px rgba(255, 165, 0, 0.5), 0 0 10px rgba(255, 165, 0, 0.7) inset; } button.operator:active { box-shadow: 0 4px 25px rgba(255, 165, 0, 0.7), 0 0 15px rgba(255, 165, 0, 1) inset; }const display = document.getElementById("display"); function inputDigit(digit) { if (display.innerText === "0") { display.innerText = digit; } else { display.innerText += digit; } } function inputOperator(operator) { const lastChar = display.innerText.slice(-1); if ("+-*/".includes(lastChar)) { display.innerText = display.innerText.slice(0, -1) + operator; } else { display.innerText += operator; } } function clearDisplay() { display.innerText = "0"; } function deleteDigit() { display.innerText = display.innerText.slice(0, -1) || "0"; } function calculate() { try { display.innerText = eval(display.innerText); } catch { display.innerText = "Error"; } }0
登录后复制
以上就是使用 html css 和 javascript 的计算器 ui 的未来的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2646238.html