๋ฐ์ํ
[์ถ์ฒ-์ ํ๋ธ ๋ ธ๋ง๋ ์ฝ๋ Nomad Coders]
CSS๋ฅผ ์๋ณผ๊ฑฐ์...
์ฐ์ ๋ฐฐ๊ฒฝ ์์ ์ง์ ํ๊ณ
๊ตฌ๊ธ์ 'reset css'๋ฅผ ๊ฒ์ํ ํ ๋ฐ์ค ์น ์ฌ์ดํธ์ ๋ค์ด๊ฐ๋ค.
์ด๋ ๊ฒ ๋ญ๊ฐ๊ฐ ๋ฐ๊ฒ์ด๋ค... ๊ณ ๋๋ก ๋ณต์ฌํ๋ค.
reset.css๋ฅผ ์๋ก ์์ฑํ๊ณ ์์ ๋ณต์ฌํ ์ฝ๋๋ฅผ ๋ถ์ฌ๋ฃ๊ธฐํ๋ค.
styles.css๋ ๋ค์๊ณผ ๊ฐ์ด ์ฝ๋๋ฅผ ์์ ํ๋ค.
์ด์ ์บ๋ฒ์ค๋ฅผ ๋ง๋ ๋ค.
index.html์ id๋ฅผ ์ฌ์ฉํ๊ณ style์ class๋ฅผ ์ฌ์ฉํ ๊ฒ์
style.css๋ฅผ ์ข๋ ์์ ํ๋ค.
@import "reset.css";
body {
background-color: #f6f9fc;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
display: flex;
flex-direction: column;
align-items: center;
padding-top: 50px;
}
.canvas {
width: 700px;
height: 700px;
background-color: white;
border-radius: 15px;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
์ด์ control์ ๋ง๋ ๋ค.
<!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="styles.css" />
<title>PaintJS</title>
</head>
<body>
<canvas id="jsCanvas" class="canvas"></canvas>
<div class="controls">
<div class="controls__colors" id="jsColors">
<div class="controls__color"></div>
<div class="controls__color"></div>
<div class="controls__color"></div>
<div class="controls__color"></div>
<div class="controls__color"></div>
<div class="controls__color"></div>
<div class="controls__color"></div>
<div class="controls__color"></div>
<div class="controls__color"></div>
</div>
</div>
<script src="app.js"></script>
</body>
</html>
์ด์ ์ controls__colorํํ ๊ฐ๊ฐ ๋ฐฐ๊ฒฝ์์ ๋ฃ์ด์ค๋ค.
<!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="styles.css" />
<title>PaintJS</title>
</head>
<body>
<canvas id="jsCanvas" class="canvas"></canvas>
<div class="controls">
<div class="controls__colors" id="jsColors">
<div class="controls__color" style="background-color: black"></div>
<div class="controls__color" style="background-color: white"></div>
<div class="controls__color" style="background-color: #ff3b3c"></div>
<div class="controls__color" style="background-color: #ff9500"></div>
<div class="controls__color" style="background-color: #ffcc00"></div>
<div class="controls__color" style="background-color: #4cd963"></div>
<div class="controls__color" style="background-color: #5ac8fa"></div>
<div class="controls__color" style="background-color: #0579ff"></div>
<div class="controls__color" style="background-color: #5856d6"></div>
</div>
</div>
<script src="app.js"></script>
</body>
</html>
controls์ ์ฝ๊ฐ์ ์คํ์ผ์ ์ค๋ค.
.controls {
margin-top: 80px;
}
.controls .controls__colors {
display: flex;
}
.controls__colors .controls__color {
width: 50px;
height: 50px;
border-radius: 25px;
cursor: pointer;
box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}
๋ฐ์ํ
'JavaScript > Vanilla JS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐ๋๋ผJS๋ก ๊ทธ๋ฆผํ ๋ง๋ค๊ธฐ] Canvas Events (2) | 2021.04.24 |
---|---|
[๋ฐ๋๋ผJS๋ก ๊ทธ๋ฆผํ ๋ง๋ค๊ธฐ] Styles part Two (0) | 2021.04.23 |
[๋ฐ๋๋ผJS๋ก ๊ทธ๋ฆผํ ๋ง๋ค๊ธฐ] Project Setup (0) | 2021.04.23 |
[๋ฐ๋๋ผJS๋ก ๊ทธ๋ฆผํ ๋ง๋ค๊ธฐ] Requirements (0) | 2021.04.23 |
[๋ฐ๋๋ผJS๋ก ๊ทธ๋ฆผํ ๋ง๋ค๊ธฐ] What are we building (0) | 2021.04.23 |
๋๊ธ