Skip to content

Commit

Permalink
push Pixel Art
Browse files Browse the repository at this point in the history
  • Loading branch information
Preetiaarya committed Aug 12, 2024
0 parents commit 4577e5f
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
24 changes: 24 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pixel Art</title>
<link rel="stylesheet" href="style.css">
</head>

<body>
<div class="h1-box">
<h1>Etch-a sketch</h1>
</div>

<div class="container-box">
<div class="container">
</div>
</div>

<script src="main.js"></script>
</body>

</html>
38 changes: 38 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

let container = document.querySelector(".container")


for (let i = 0; i < 100; i++) {
let child = document.createElement("div")
child.classList.add("child")
container.appendChild(child)
// console.log(child)
child.addEventListener("click", () => {
if (child.style.backgroundColor === "white") {
child.style.backgroundColor = "black"
} else {
child.style.backgroundColor = "white"
}
})
}















// $(document).ready(function(){
// $("child").toggle(
// function(){$("child").css({"color": "white"});
// });
// });

24 changes: 24 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.container {
height: 250px;
width: 250px;
display: inline-grid;
grid-template-columns: auto auto auto auto auto auto auto auto auto auto;
}

.child {
width: 93%;
height: 25px;
border: 1px solid black;
color: white;
}

.h1-box{
display: flex;
justify-content: center;
}
.container-box{
display: flex;
justify-content: center;
}


0 comments on commit 4577e5f

Please sign in to comment.