<!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>JavaScript Calculator</title>
<link rel="stylesheet" href="calc.css">
</head>
<body>
<section class="calculator">
<form>
<input type="text" class="screen">
</form>
<div class="buttons">
<button type="button" class="btn btn-yellow" data-num="*">*</button>
<button type="button" class="btn btn-yellow" data-num="/">/</button>
<button type="button" class="btn btn-yellow" data-num="-">-</button>
<button type="button" class="btn btn-yellow" data-num="+">+</button>
<button type="button" class="btn btn-grey" data-num="9">9</button>
<button type="button" class="btn btn-grey" data-num="8">8</button>
<button type="button" class="btn btn-grey" data-num="7">7</button>
<button type="button" class="btn btn-grey" data-num="6">6</button>
<button type="button" class="btn btn-grey" data-num="5">5</button>
<button type="button" class="btn btn-grey" data-num="4">4</button>
<button type="button" class="btn btn-grey" data-num="3">3</button>
<button type="button" class="btn btn-grey" data-num="2">2</button>
<button type="button" class="btn btn-grey" data-num="1">1</button>
<button type="button" class="btn btn-grey" data-num="0">0</button>
<button type="button" class="btn btn-grey" data-num=".">.</button>
<button type="button" class="btn btn-equal">=</button>
<button type="button" class="btn btn-clear">C</button>
</div>
</section>
<script src="calc.js"></script>
</body>
</html>
calc.css
--------------------------------------------------------------------------
*{
margin:0;
padding: 0;
box-sizing: border-box;
}
body{
min-height: 100vh;
background-color: aliceblue;
display: flex;
justify-content: center;
align-items: center;
}
.calculator{
width: 300px;
height: 500px;
box-shadow: 4px 4px 30px ;
border-radius: 12px;
background: wheat;
overflow: hidden;
}
form input {
width: 100%;
height: 150px;
border: none;
border-radius: 12px ;
font-size: 2rem;
padding: 1rem;
color: white;
background: rgb(90, 87, 87);
text-align: right;
pointer-events: none;
}
.buttons{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 20px;
}
button{
flex: 0 0 22%;
width: 60px;
height: 52px;
font-size: 22px;
font-weight: 600;
box-sizing: 5px;
cursor: pointer;
}
.btn-yellow{
background: orange;
}
.btn-grey{
background: cyan;
}
.btn-equal{
background: green;
}
.btn-clear{
background: red;
}
No comments:
Post a Comment