계산기 목업 만들기

fejigu·2022년 7월 3일
2

HTML / CSS

목록 보기
3/5
post-thumbnail

위의 사진과 같은 계산기 목업을 만들어보자

1. 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">
  <title>Document</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <div class="calculator">
    <div class="result">
      <div class="text">0</div>
    </div>

    <div class="container">
      <div class="box">
        <button class="start">AC</button>
        <button class="start">ENTER</button>
      </div>
      <div class="box">
        <button class="number">7</button>
        <button class="number">8</button>
        <button class="number">9</button>
        <button class="operator">+</button>
      </div>
      <div class="box">
        <button class="number">4</button>
        <button class="number">5</button>
        <button class="number">6</button>
        <button class="operator">-</button>
      </div>
      <div class="box">
        <button class="number">1</button>
        <button class="number">2</button>
        <button class="number">3</button>
        <button class="operator">*</button>
      </div>
      <div class="box">
        <button class="number0">0</button>
        <button class="number">.</button>
        <button class="operator">/</button>
      </div>
    </div>
  </div>
</body>
</html>

2. css 코드

.calculator {
  width: 350px;
  height: 500px;
  border: 1px solid blue;
  border-radius: 15px 15px;
  background-color: blue;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

* {
  box-sizing: border-box;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid red;
  height: 100vh;
}

.result{
  width: 300px;
  border: 1px solid blue;
  margin: 10px;
  height: 100px;
  border-radius: 15px 15px;
  background-color: white;
  display: flex;
  flex-direction: row-reverse;
}

.container{
  width: 300px;
  border: 1px solid blue;
  margin: 10px;
  height: 350px;
  border-radius: 15px 15px;
  background-color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}


.text{
  margin: 20px 15px;
}

.box{
  width: 270px;
  height: 60px;
  margin: 4px;
  background-color: rgb(179, 214, 229);
}

.start{
  width: 60px;
  height: 50px;
  border-radius: 15px 15px;
  background-color: rgb(59, 207, 59);
  margin: 0px 4px;
}

.number{
  width: 60px;
  height: 50px;
  border-radius: 15px 15px;
}

.number0{
  width: 120px;
  height: 50px;
  border-radius: 15px 15px;
}

.operator{
  width: 60px;
  height: 50px;
  border-radius: 15px 15px;
  background-color: black;
  color: white;
}

위의 코드를 통해 만들어낸 계산기 목업

profile
console.log(frontendjigu( ☕️, 📱); // true

0개의 댓글