Here is the first code that's all I wanted. but with the grid
layout. this is float
based layout
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
max-width: 600px;
margin: 0 auto;
background-color: #232323;
}
.square {
padding-bottom: 30%;
width: 30%;
background-color: #399099;
float: left;
margin: 1.66%;
}
.content {
clear: both;
}
</style>
</head>
<body>
<div class="header">
<h1><span id="target">RGB</span> color game</h1>
</div>
<div id="manue">
<button id="reset">New Color</button>
<p id="massage"></p>
<div id="lavel">
<button id="easy">Easy</button>
<button id="heard">Heard</button>
</div>
</div>
<div class="container">
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="content"></div>
</div>
<script src="index.pack.js"></script>
</body>
</html>
<script src="index.pack.js"></script>
</body>
</html>
This is the result all I wanted but with grid
I tried first this one
max-width: 650px;
margin: 0 auto;
padding: 4rem;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
grid-gap: 10px;
}```
I got this I don't want the squares stack on top of each other on mobile view
then I tried this one
grid-template-columns: repeat(3, 1fr);
But this time I got this Why they so far from each other?
Can anyone please tell me how can I achieve the float-based layout with gird?