[HTML/CSS] Calculator Mock-up

Hannahhh·2022년 7월 4일
0

Practice

목록 보기
1/5
post-thumbnail



HTML


<!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">
    <link rel="stylesheet" href="style.css">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Concert+One&family=Press+Start+2P&display=swap');
        </style>
    <title>Document</title>
</head>
<body>
    <div class="calculator">
        <div class = "menu">
        <div class="display">
            0 
        </div>
        <div class="buttonPad">
            <div class="buttonLine">
                <button id ="ac" class="operator">AC </button>
                <button id ="enter" class="operator">Enter</button>
            </div>
            <div class="buttonLine">
                <button class="number">7</button>
                <button class="number">8</button>
                <button class="number">9</button>
                <button class="operator">+</button>
            </div>
            <div class="buttonLine">
                <button class="number">4</button>
                <button class="number">5</button>
                <button class="number">6</button>
                <button class="operator">-</button>
            </div>
            <div class="buttonLine">
                <button class="number">1</button>
                <button class="number">2</button>
                <button class="number">3</button>
                <button class="operator">*</button>
            </div>
            <div class="buttonLine">
                <button class="number num0">0</button>
                <button class="operator">.</button>
                <button class="operator">/</button>
            </div>
        </div>
        </div>
    </div>
</body>
</html>




CSS



.calculator {
    width: 350px;
    height: 550px;
    background: linear-gradient(#ffc8dd , #bde0fe);
    align-items: center;
    justify-content: center;
    display: flex;
    flex-direction: column;
    border-top: 2px solid rgba(250, 250, 250, 0.795);
    border-left: 2px solid rgba(250, 250, 250, 0.733);
    box-shadow: 10px 20px 30px rgba(0, 0, 0, 0.15);
  }

  body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    padding: 0;
    background:linear-gradient( #bde0fe, #ffc8dd );
  }
  
  .display{
    background-color: #fff4f8;
    display: flex;
    justify-content: flex-end;
    height: 100px;
    font-size: 30px;
    color: #cdb4db;
    margin: 0 14px 10px 14px;
    padding: 10px 12px;
  }

  .buttonPad{
    display: flex;
    flex-direction: column;
}

  .buttonLine{
    margin: 10px;
    display: flex;
  }

  button {
    margin: 0px 7px;
    width: 60px;
    height: 60px;
    font-size: 30px;
    color:#ffffff;
    border-radius: 50%;
    border:none;
    background-color: #cdb4db;
    box-shadow: 0px 5px 0px 0px #b157e68e;
    transition-duration: 0.3s;
  }

  button:hover{
    margin-top: 1px;
    margin-bottom: 1px;
}

button:active {
    box-shadow: 0px 0px;
}

  .operator:hover{
    box-shadow: 0px 0px 0px 0px #b157e68e;
  }

  .number:hover{
    box-shadow: 0px 0px 0px 0px #b157e68e;
  }

  .num0{
    flex: 1;
    border-radius: 10px;
  }

  .num0:hover{
    box-shadow: 0px 0px 0px 0px #b157e68e;
  }

  #ac {
    width: 50%;
    background-color: #ffafcc;
    box-shadow: 0px 5px 0px 0px #f893b8;
    color:#fff;
    border-radius: 10px;
}
#ac:hover{
   box-shadow: 0px 0px 0px 0px #f893b8;
}
#enter {
    width: 50%;
    border-radius: 10px;
    background-color: #a2d2ff;
    box-shadow: 0px 5px 0px 0px #76b9f8;
}
#enter:hover {
  box-shadow: 0px 0px 0px 0px #76b9f8;
}

  * {
    box-sizing: border-box;
    border-radius: 10px;
    font-family: 'Concert One', cursive;
  }

0개의 댓글