How to make chessboard using html and css
In this article, we will learn how to make chessboard using HTML and CSS. i take a class name container which have height 800 px and width 800px. and talking a row with height 100px and width 800px; which manage the row of chessbaord and taking two classes for black and white box which have height 100px and width 100px. here is the complete code.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Chessboard Using HTML and CSS</title> <style> .container { height: 800px; width:800px; box-sizing: border-box; border:1px solid #000; margin:0 auto; } .row{ height: 100px; width:800px; display: flex; } .black{ height: 100px; width:100px; background-color: #000; } .white{ height: 100px; width:100px; background-color: #fff; } </style> </head> <body> <div class="container"> <div class="row"> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> </div> <div class="row"> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> </div> <div class="row"> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> </div> <div class="row"> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> </div> <div class="row"> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> </div> <div class="row"> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> </div> <div class="row"> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> </div> <div class="row"> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> <div class="white"></div> <div class="black"></div> </div> </div> </body> </html>