//**********JQUERY**********
<script>let dis = document.getElementById('outputscreen');
const wipe = () => {
dis.value = "";
}
const display = (n) => {
dis.value += n;
}
const calculate = () => {
dis.value = eval(dis.value);
}
</script>
//***********style**************
*{
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: #ecf0f3;
font-family: sans-serif;
outline: none;
}
.cointainer{
height: 100vh;
display: flex;
justify-content: center;
align-items: center
}
.calculator{
background-color: #ecf0f3;
padding: 15px;
border-radius:30px;
box-shadow: inset 5px 5px 12px #ffffff,
5px 5px 12px rgba(0,0,0,.16);
display: grid;
grid-template-columns: repeat(4,68px);
}
input{
grid-column: span 4;
height: 70px;
width: 260px;
background-color:#ecf0f3;
box-shadow: inset -5px -5px 12px #ffffff,
inset 5px 5px 12px rgba(0,0,0,.16);
border: none;
border-radius: 30px;
color: rgba(70,70,70);
font-size: 50px;
text-align: end;
margin: auto;
margin-top:40px;
margin-bottom: 30px;
}
button{
height:48px;
width:48px;
background-color:#ecf0f3;
box-shadow: -5px -5px 12px #ffffff,
5px 5px 12px rgba(0,0,0,.16);
border:none;
border-radius: 50%;
margin:8px;
font-size: 16px;
}
.equal{
width:115px;
border-radius: 40px;
background-color: #ecf0f3;
box-shadow: -5px -5px 12px #ffffff,
5px 5px 12px rgba(0,0,0,.16);
}
//*************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>
<link rel="stylesheet" href="style.css">
<script src="scripts-file/javascript.js"></script>
</head>
<body>
<div class="cointainer">
<div class="calculator">
<input type="text" placeholder="0" id="outputscreen">
<button onclick="wipe()">Cl</button>
<button onclick="wipe()">DEL</button>
<button onclick="display('%')">%</button>
<button onclick="display('/')">/</button>
<button onclick="display('7')">7</button>
<button onclick="display('8')">8</button>
<button onclick="display('9')">9</button>
<button onclick="display('*')">*</button>
<button onclick="display('4')">4</button>
<button onclick="display('5')">5</button>
<button onclick="display('6')">6</button>
<button onclick="display('-')">-</button>
<button onclick="display('1')">1</button>
<button onclick="display('2')">2</button>
<button onclick="display('3')">3</button>
<button onclick="display('+')">+</button>
<button onclick="display('.')">.</button>
<button onclick="display('0')">0</button>
<button onclick="calculate()" class="equal">=</button>
</div>
</div>
</body>
</html>
Comments
Post a Comment