{"id":372952,"date":"2022-09-09T06:21:29","date_gmt":"2022-09-09T13:21:29","guid":{"rendered":"https:\/\/css-tricks.com\/?p=372952"},"modified":"2022-09-09T13:14:21","modified_gmt":"2022-09-09T20:14:21","slug":"how-i-made-a-pure-css-puzzle-game","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/how-i-made-a-pure-css-puzzle-game\/","title":{"rendered":"How I Made a Pure CSS Puzzle Game"},"content":{"rendered":"\n

I recently discovered the joy of creating CSS-only games. It\u2019s always fascinating how HTML and CSS are capable of handling the logic of an entire online game, so I had to try it! Such games usually rely on the ol\u2019 Checkbox Hack where we combine the checked\/unchecked state of a HTML input with the :checked<\/code> pseudo-class in CSS. We can do a lot of magic with that one combination!<\/p>\n\n\n\n

In fact, I challenged myself to build an entire game without Checkbox. I wasn\u2019t sure if it would be possible, but it definitely is, and I\u2019m going to show you how.<\/p>\n\n\n\n\n\n\n\n

In addition to the puzzle game we will study in this article, I have made a collection of pure CSS games<\/a>, most of them without the Checkbox Hack. (They are also available on CodePen<\/a>.)<\/p>\n\n\n

Want to play before we start?<\/h3>\n\n\n

I personally prefer playing the game in full screen mode, but you can play it below or open it up over here<\/a>.<\/p>\n\n\n\n