How to Make Fantastic Calculator?
Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;600&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Calibri', sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #091921;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(#e91e63, #ffc107);
clip-path: circle(22% at 30% 20%);
}
body::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(#ffffff, #da00ff);
clip-path: circle(20% at 70% 90%);
}
.container {
position: relative;
background: rgba(255, 255, 255, 0.05);
border-radius: 6px;
overflow: hidden;
z-index: 10;
backdrop-filter: blur(15px);
border-top: 1px solid rgba(255, 255, 255, 0.199);
border-left: 1px solid rgba(255, 255, 255, 0.199);
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
}
.container .calculator {
position: relative;
display: grid;
}
.container .calculator .value {
grid-column: span 4;
height: 140px;
width: 300px;
text-align: right;
border: none;
outline: none;
padding: 10px;
font-size: 40px;
background: transparent;
color: #fff;
border-top: 1px solid rgba(255, 255, 255, 0.05);
border-left: 1px solid rgba(255, 255, 255, 0.05);
}
.container .calculator span {
display: grid;
place-items: center;
width: 75px;
height: 75px;
color: #fff;
font-weight: 400;
cursor: pointer;
font-size: 30px;
user-select: none;
border-top: 1px solid rgba(255, 255, 255, 0.05);
border-left: 1px solid rgba(255, 255, 255, 0.05);
transition: 0.5s;
}
.container .calculator span:hover {
transition: 0s;
background: rgba(255, 255, 255, 0.05);
}
.container .calculator span:active {
background: #00f7ff;
color: #193f00;
font-size: 24px;
font-weight: 500;
}
.container .calculator .clear {
grid-column: span 2;
width: 150px;
background: rgba(255, 255, 255, 0.05);
}
.container .calculator .plus {
grid-row: span 2;
height: 150px;
}
.equal {
background: rgba(255, 255, 255, 0.05);
}
</style>
</head>
<body>
<div class="container">
<form class="calculator" name="calc">
<input type="text" readonly class="value" name="txt" />
<span class="num clear" onclick="calc.txt.value = ''">c</span>
<span class="num" onclick="document.calc.txt.value += '/'">/</span>
<span class="num" onclick="document.calc.txt.value += '*'">*</span>
<span class="num" onclick="document.calc.txt.value += '7'">7</span>
<span class="num" onclick="document.calc.txt.value += '8'">8</span>
<span class="num" onclick="document.calc.txt.value += '9'">9</span>
<span class="num" onclick="document.calc.txt.value += '-'">-</span>
<span class="num" onclick="document.calc.txt.value += '4'">4</span>
<span class="num" onclick="document.calc.txt.value += '5'">5</span>
<span class="num" onclick="document.calc.txt.value += '6'">6</span>
<span class="num plus" onclick="document.calc.txt.value += '+'">+</span>
<span class="num" onclick="document.calc.txt.value += '1'">1</span>
<span class="num" onclick="document.calc.txt.value += '2'">2</span>
<span class="num" onclick="document.calc.txt.value += '3'">3</span>
<span class="num" onclick="document.calc.txt.value += '0'">0</span>
<span class="num" onclick="document.calc.txt.value += '00'">00</span>
<span class="num" onclick="document.calc.txt.value += '.'">.</span>
<span class="num equal" onclick="document.calc.txt.value = eval(calc.txt.value)">=</span>
</form>
</div>
</body>
</html>
Download
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;600&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Calibri', sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background-color: #091921;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(#e91e63, #ffc107);
clip-path: circle(22% at 30% 20%);
}
body::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(#ffffff, #da00ff);
clip-path: circle(20% at 70% 90%);
}
.container {
position: relative;
background: rgba(255, 255, 255, 0.05);
border-radius: 6px;
overflow: hidden;
z-index: 10;
backdrop-filter: blur(15px);
border-top: 1px solid rgba(255, 255, 255, 0.199);
border-left: 1px solid rgba(255, 255, 255, 0.199);
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
}
.container .calculator {
position: relative;
display: grid;
}
.container .calculator .value {
grid-column: span 4;
height: 140px;
width: 300px;
text-align: right;
border: none;
outline: none;
padding: 10px;
font-size: 40px;
background: transparent;
color: #fff;
border-top: 1px solid rgba(255, 255, 255, 0.05);
border-left: 1px solid rgba(255, 255, 255, 0.05);
}
.container .calculator span {
display: grid;
place-items: center;
width: 75px;
height: 75px;
color: #fff;
font-weight: 400;
cursor: pointer;
font-size: 30px;
user-select: none;
border-top: 1px solid rgba(255, 255, 255, 0.05);
border-left: 1px solid rgba(255, 255, 255, 0.05);
transition: 0.5s;
}
.container .calculator span:hover {
transition: 0s;
background: rgba(255, 255, 255, 0.05);
}
.container .calculator span:active {
background: #00f7ff;
color: #193f00;
font-size: 24px;
font-weight: 500;
}
.container .calculator .clear {
grid-column: span 2;
width: 150px;
background: rgba(255, 255, 255, 0.05);
}
.container .calculator .plus {
grid-row: span 2;
height: 150px;
}
.equal {
background: rgba(255, 255, 255, 0.05);
}
</style>
</head>
<body>
<div class="container">
<form class="calculator" name="calc">
<input type="text" readonly class="value" name="txt" />
<span class="num clear" onclick="calc.txt.value = ''">c</span>
<span class="num" onclick="document.calc.txt.value += '/'">/</span>
<span class="num" onclick="document.calc.txt.value += '*'">*</span>
<span class="num" onclick="document.calc.txt.value += '7'">7</span>
<span class="num" onclick="document.calc.txt.value += '8'">8</span>
<span class="num" onclick="document.calc.txt.value += '9'">9</span>
<span class="num" onclick="document.calc.txt.value += '-'">-</span>
<span class="num" onclick="document.calc.txt.value += '4'">4</span>
<span class="num" onclick="document.calc.txt.value += '5'">5</span>
<span class="num" onclick="document.calc.txt.value += '6'">6</span>
<span class="num plus" onclick="document.calc.txt.value += '+'">+</span>
<span class="num" onclick="document.calc.txt.value += '1'">1</span>
<span class="num" onclick="document.calc.txt.value += '2'">2</span>
<span class="num" onclick="document.calc.txt.value += '3'">3</span>
<span class="num" onclick="document.calc.txt.value += '0'">0</span>
<span class="num" onclick="document.calc.txt.value += '00'">00</span>
<span class="num" onclick="document.calc.txt.value += '.'">.</span>
<span class="num equal" onclick="document.calc.txt.value = eval(calc.txt.value)">=</span>
</form>
</div>
</body>
</html>
Comments
Post a Comment