mirror of
https://github.com/10h30/odin-etch-a-sketch.git
synced 2026-07-11 18:55:58 +09:00
Make Grid
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Etch A Sketch</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
const container = document.querySelector(".container")
|
||||
const containerWidth = document.querySelector(".container").clientWidth;
|
||||
console.log(containerWidth)
|
||||
|
||||
for (let i=0; i < 16*16; i++) {
|
||||
const squareBox = document.createElement("div")
|
||||
container.appendChild(squareBox)
|
||||
squareBox.setAttribute('class', 'grid')
|
||||
squareBox.style.width= containerWidth / 16 + "px";;
|
||||
squareBox.style.height= containerWidth / 16 + "px";;
|
||||
}
|
||||
Reference in New Issue
Block a user