Home
Tutorial
JavaScript Games
Build Beautiful Tic Tac Toe Game with Pure JavaScript
Online HTML Editor : Tic Tac Toe Game Board Design
Run Output
Output Rosolution:
<!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Tic Tac Toe Game Board</title> <style> *{ box-sizing: border-box; } body{ margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; flex-direction: column; } .players{ border: 2px solid #0909ad; display: flex; justify-content: center; align-items: center; border-radius: 15px; font-size: 24px; margin-top: 100px; } .players div{ padding: 15px 25px; border-radius: 15px; border: 2px solid #fff; } .players div.active{ background: #0909ad; color: #fff; } .game-board{ margin-top: 50px; display: grid; grid-template-columns: repeat(3, auto); } .cell{ height: 100px; width: 100px; border: 2px solid #0909ad; font-size: 100px; display: flex; justify-content: center; align-items: center; cursor: pointer; border-radius: 10px; } .cell.X{ color: #09aecb; } .cell.O{ color:#e50c35; } .cell:nth-child(1),.cell:nth-child(2),.cell:nth-child(3){ border-top: none; } .cell:nth-child(3n + 1){ border-left: none; } .cell:nth-child(3n){ border-right: none; } .cell:nth-child(7),.cell:nth-child(8),.cell:nth-child(9){ border-bottom: none; } </style> </head> <body> <div class="players"> <div class="player1 active">O's Turn</div> <div class="player2">X's Turn</div> </div> <div class="game-board"> <div class="cell X">X</div> <div class="cell X">X</div> <div class="cell O">O</div> <div class="cell"></div> <div class="cell O">O</div> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> <div class="cell"></div> </div> </body> </html>