I have been working on creating an 8x8 chessboard by following this example: https://codepen.io/sammyslamma/pen/gJeOwY
.flex-container {
display: flex;
flex-flow: row;
flex-wrap: wrap;
height: 336px;
width: 336px;
}
.chessboard {
border: 1px solid black;
width: 40px;
height: 40px;
}
.chessboard div:nth-child(odd) {
background-color: blue;
}
<div class="flex-container">
<div id="tile">
<script>
for(x=0; x<64;x++) {
var tile = document.createElement('div');
tile.className = "chessboard";
document.getElementById('tile').appendChild(tile); }
</script>
</div>
</div>
I have created 64 divs under the class name "chessboard", but I am having trouble making the squares go across to form an 8 by 8 grid. I have tried setting the height, width, and flex-basis to 12.5%, but it didn't work as expected.
Any guidance on how to achieve the desired layout would be greatly appreciated. Thank you!