Connect 4 with :has() by Jhey Tompkins on CodePen
Open on CodePen ↗A working 3D Connect 4 game by Jhey Tompkins, built with CSS and not a single line of JavaScript. It relies on the :has() selector.
Hidden checkboxes stand for the disc drops, CSS counters handle whose turn it is, and :has() checks for four in a row across, down and diagonally.
games:has():checkedcounter()
The modern.css newsletter
New CSS each month, and new things in the Atlas. 806 subscribers. Past issues
by Jhey Tompkins
Best in Chromeby Ben Evans
by Jhey Tompkins