Glassmorphism calculator using html, css, js
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #222;
height: 100vh;
}
.container {
width: 300px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
position: relative;
}
form {
text-align: center;
background: rgba(180, 180, 190, 0.6);
border: 1px solid rgba(200, 200, 200, 0.9);
padding: 50px 10px;
backdrop-filter: blur(2px);
}
input[type="text"] {
background: #222;
border: 1px solid rgba(200, 200, 200, 0.6);
outline: none;
height: 30px;
width: 80%;
padding: 4px 4px;
font-weight: 500;
color: rgba(4, 129, 185, 1);
font-size: 20px;
letter-spacing: 2px;
border-radius: 20px;
}
input[type="button"] {
width: 30px;
height: 30px;
margin: 5px 7px;
border: 2px solid transparent;
outline: none;
color: #222;
background: transparent;
font-weight: bold;
font-size: 20px;
display: inline-block;
}
input[type="button"]:hover {
color: rgba(131, 188, 13, 1);;
transform: scale(1.1);
}
input.op:hover {
color: orangered;
}
input.clear {
width: 60px;
}
.ball {
width: 140px;
height: 140px;
border-radius: 50%;
position: absolute;
z-index: -3;
}
.ball1 {
background: orangered;
top: -70px;
left: -58px;
}
.ball2 {
background: rgba(131, 188, 13, 1);
bottom: -70px;
right: -58px;
}
</style>
</head>
<body>
<div class="container">
<form name="forms">
<input type="text" name="answer" id="answer">
<br>
<br>
<input type="button" value="×" class="op" onclick="forms.answer.value += '*'">
<input type="button" value="÷" class="op" onclick="forms.answer.value += '/'">
<input type="button" value="+" class="op" onclick="forms.answer.value += '+'">
<input type="button" value="-" class="op" onclick="forms.answer.value += '-'">
<br>
<br>
<input type="button" value="1" onclick="forms.answer.value += '1'">
<input type="button" value="2" onclick="forms.answer.value += '2'">
<input type="button" value="3" onclick="forms.answer.value += '3'">
<input type="button" value="%" class="op" onclick="forms.answer.value += '%'">
<br>
<br>
<input type="button" value="4" onclick="forms.answer.value += '4'">
<input type="button" value="5" onclick="forms.answer.value += '5'">
<input type="button" value="6" onclick="forms.answer.value += '6'">
<input type="button" value="**" class="op" onclick="forms.answer.value += '**'">
<br>
<br>
<input type="button" value="7" onclick="forms.answer.value += '7'">
<input type="button" value="8" onclick="forms.answer.value += '8'">
<input type="button" value="9" onclick="forms.answer.value += '9'">
<input type="button" value="=" class="op" onclick="forms.answer.value = eval(forms.answer.value)">
<br>
<br>
<input type="button" value="Clear" class="op clear" onclick="forms.answer.value = ''">
<input type="button" value="0" onclick="forms.answer.value += '0'">
<input type="button" value="." class="op" onclick="forms.answer.value += '.'">
</form>
<div class="ball ball1"></div>
<div class="ball ball2"></div>
</div>
</body>
</html