<!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>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function () {
dis = "";
for (var i = 1; i <= 40; i++) {
for (var j = 1; j <= 40; j++) {
dis += "<div class='son" + i + "_" + j + "'></div>"
}
}
$("#father").html(dis);
})
</script>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
#father {
width: 1000px;
height: 1000px;
margin: auto;
}
#father::after {
content: "";
display: block;
clear: both;
}
[class*=son] {
width: 2.5%;
height: 2.5%;
background-color: #999;
float: left;
}
.true {
background-color: #0f0;
}
</style>
</head>
<body>
<div id="father"></div>
</body>
</html>