From 4d2850f7e4b0c914cfef2c79c9c4620cb0316c67 Mon Sep 17 00:00:00 2001 From: ShikhaKumari01 <122292239+ShikhaKumari01@users.noreply.github.com> Date: Tue, 31 Oct 2023 14:20:45 +0530 Subject: [PATCH] Create Responsive Calculator --- Responsive Calculator | 127 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 Responsive Calculator diff --git a/Responsive Calculator b/Responsive Calculator new file mode 100644 index 0000000..920f920 --- /dev/null +++ b/Responsive Calculator @@ -0,0 +1,127 @@ +-------------------------------------------------------------------index.html---------------------------------------------------------------------------------------------- + + + + + + + Calculator + + + + + +
+
+ +
+
+
+ + + + + +
+
+ + + + +
+
+ + + + +
+
+ + + + +
+
+
+ + + + + +-------------------------------------------------------------------style.css---------------------------------------------------------------------------------------------- + +body{ + background: url("calci_bg.jpg"); + background-size: cover; + background-repeat: no-repeat; + background-attachment: fixed; + overflow: hidden; + font-family: Arial, sans-serif; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + margin: 0; +} + +.calculator { + background-color: #e3e3e3; + border-radius: 5px; + width: 400px; + padding: 10px; + text-align: center; +} + +.display input { + width: 90%; + padding: 10px; + font-size: 20px; + margin-bottom: 10px; +} + +.buttons .row { + display: flex; + justify-content: space-between; +} + +.buttons button { + width: 23%; + height: 70px; + font-size: 24px; + margin: 5px; + border: none; + border-radius: 5px; + background-color: #212121; + color: white; + cursor: pointer; +} + +.buttons button:hover { + background-color: #555; +} + + + +-------------------------------------------------------------------script.js---------------------------------------------------------------------------------------------- + + +let input = document.getElementById('result'); + +function appendToInput(value) { + input.value += value; +} + +function clearInput() { + input.value = ''; +} + +function calculateResult() { + try { + input.value = eval(input.value); + } catch (error) { + input.value = 'Error'; + } +} + + +