-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>Prashanth Calculator</title> | ||
<link rel="icon" type="image/x-icon" href="assets/images/favicon.ico"> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="stylesheet" href="style.css" /> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="calculator"> | ||
<h1>Calculator</h1> | ||
<input type="text" id="inputBox" placeholder="0" /> | ||
<div> | ||
<button class="button operator">AC</button> | ||
<button class="button operator">DEL</button> | ||
<button class="button operator">%</button> | ||
<button class="button operator">/</button> | ||
</div> | ||
<div> | ||
<button class="button">7</button> | ||
<button class="button">8</button> | ||
<button class="button">9</button> | ||
<button class="button equalBtn">*</button> | ||
</div> | ||
<div> | ||
<button class="button">4</button> | ||
<button class="button">5</button> | ||
<button class="button">6</button> | ||
<button class="button equalBtn">-</button> | ||
</div> | ||
<div> | ||
<button class="button">1</button> | ||
<button class="button">2</button> | ||
<button class="button">3</button> | ||
<button class="button equalBtn">+</button> | ||
</div> | ||
|
||
<div> | ||
|
||
<button class="button">0</button> | ||
<button class="button">.</button> | ||
<button class="button numberBtn">=</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
let input = document.getElementById('inputBox'); | ||
let buttons = document.querySelectorAll('button'); | ||
|
||
let string = ""; | ||
let arr = Array.from(buttons); | ||
arr.forEach(button => { | ||
button.addEventListener('click', (e) =>{ | ||
if(e.target.innerHTML == '='){ | ||
string = eval(string); | ||
input.value = string; | ||
} | ||
|
||
else if(e.target.innerHTML == 'AC'){ | ||
string = ""; | ||
input.value = string; | ||
} | ||
else if(e.target.innerHTML == 'DEL'){ | ||
string = string.substring(0, string.length-1); | ||
input.value = string; | ||
} | ||
else{ | ||
string += e.target.innerHTML; | ||
input.value = string; | ||
} | ||
|
||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500&display=swap'); | ||
|
||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
font-family: 'Poppins', sans-serif; | ||
} | ||
|
||
body { | ||
width: 100%; | ||
height: 100vh; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background-size: cover; | ||
background-position: center; | ||
background-blend-mode: overlay; | ||
background-color: rgba(0, 0, 0, 0.5); /* Dark overlay to ensure text readability */ | ||
background: url('img/bg.jpg'); | ||
} | ||
|
||
.calculator { | ||
border: 1px solid #94c312; | ||
padding: 20px; | ||
border-radius: 16px; | ||
background: transparent; | ||
background-image: url('img/bg1.jpg'); /* Replace URL_TO_YOUR_IMAGE_HERE with your image link */ | ||
box-shadow: 0px 3px 15px rgba(44, 221, 56, 0.5); | ||
} | ||
|
||
input { | ||
width: 320px; | ||
border: none; | ||
padding: 24px; | ||
margin: 10px; | ||
background: transparent; | ||
box-shadow: 0px 18px 20px rgba(84, 84, 84, 0.1); | ||
font-size: 40px; | ||
text-align: right; | ||
cursor: pointer; | ||
color: #ffffff; | ||
} | ||
|
||
input::placeholder { | ||
color: #ffffff; | ||
} | ||
|
||
button { | ||
border: none; | ||
width: 60px; | ||
height: 60px; | ||
margin: 10px; | ||
border-radius: 50%; | ||
background: transparent; | ||
color: #ffffff; | ||
font-size: 20px; | ||
box-shadow: -8px -8px 15px rgba(219, 216, 216, 0.1); | ||
cursor: pointer; | ||
} | ||
|
||
.equalBtn { | ||
border: none; | ||
width: 50px; | ||
height: 50px; | ||
margin: 10px; | ||
border-radius: 15px; | ||
background-color: #fb7c14; | ||
font-size: 30px; | ||
} | ||
|
||
.numberBtn { | ||
border: none; | ||
width: 140px; | ||
height: 60px; | ||
margin: 10px; | ||
border-radius: 25px; | ||
background-color: #fb7c14; | ||
color: #ffffff; | ||
font-size: 30px; | ||
|
||
cursor: pointer; | ||
} | ||
|
||
.operator { | ||
color: #6dee0a; | ||
} | ||
|
||
h1, h2 { | ||
font-family: 'Poppins', sans-serif; | ||
font-weight: 400; | ||
color: #d0e10b; | ||
line-height: 1.25em; | ||
} |