A modern, accessible, and responsive Tic-Tac-Toe game built with vanilla HTML, CSS, and JavaScript.
- 🎮 Classic Gameplay: Traditional two-player Tic-Tac-Toe
- ♿ Accessibility: Full ARIA support for screen readers
- ⌨️ Keyboard Navigation: Play using keyboard (Tab, Enter, Space)
- 📱 Responsive Design: Works seamlessly on desktop and mobile
- 🎨 Modern UI: Beautiful gradient design with smooth animations
- 🏆 Visual Feedback: Winning combinations highlighted with animations
- Player X always goes first
- Click on any empty cell to place your mark
- Players alternate turns automatically
- First player to get 3 marks in a row (horizontal, vertical, or diagonal) wins
- If all cells are filled with no winner, it's a draw
- Click "Reset Game" to start a new game
- Mouse: Click any cell to make a move
- Keyboard:
- Tab to navigate between cells
- Enter or Space to select a cell
- Tab to the Reset button and press Enter to restart
├── index.html # Main game structure with semantic HTML
├── style.css # Responsive styling and animations
├── script.js # Game logic and interactivity
└── README.md # This documentation
- ARIA labels and roles for screen readers
- Live regions for game status updates
- Keyboard navigation support
- Focus management
- Object-oriented design with
TicTacToeclass - Win detection for all 8 possible combinations
- Draw detection when board is full
- State management for game board and current player
- CSS Grid for game board layout
- CSS animations for winning combinations
- Responsive design with mobile-first approach
- Smooth transitions and hover effects
This game works in all modern browsers:
- Chrome 60+
- Firefox 55+
- Safari 12+
- Edge 79+
- Clone or download this repository
- Open
index.htmlin your web browser - Start playing!
No build tools or dependencies required - it's pure vanilla web technologies!
Feel free to submit issues or pull requests to improve the game. Some ideas for enhancements:
- AI opponent
- Score tracking
- Different board sizes
- Sound effects
- Theme customization
This project is open source and available under the MIT License.