I'm making a html chess board. The problem is between each row there are unwanted space
I'm trying to remove vertical space between the div elements with margin-top: 0px
. But it doesn't work? My browser is Firefox
Here is the javascript i use to generate the chess board
for (var i = 0; i < 8; i++) {
let row = document.createElement("div");
row.className = "row";
for (var j = 0; j < 8; j++) {
let tile = document.createElement("div");
tile.className = "tile";
tile.id = `${i}_${j}`
if (i % 2 == j % 2) {
tile.style.background = "white"
} else {
tile.style.background = "gray"
}
row.appendChild(tile);
}
document.getElementById("game").appendChild(row);
}
body {
background-color: black;
}
.tile {
height: 60px;
width: 60px;
display: inline-block;
}
.row {
margin-top: 0px;
}
<body>
<div id="menu"></div>
<div id="game"></div>
<script src="client.js"></script>
</body>