Flex-Cheat is thirty lines of CSS, exposed as six classes, which can be mixed and matched to produce pretty much any HTML element layout using the magic of flexboxes.

In a recent post on HackerNews, a lot of commentators lamented the difficulty of laying out HTML elements using CSS. I used to find laying elements out in HTML using CSS quite annoying and tedious too — until flexbox came along, and made life a lot easier, at least when it comes to layouts.

For the past few years, I’ve used the same six custom classes and their associated CSS style declarations, as a layout helper for my applications. By mixing and matching these classes, I’ve been able to generate pretty much any layout I’ve wanted to, with minimal pain.