Skip to content

Comment on My favourite 3 lines of CSS

Comments

Shout out to Andy and Heydon for their book Every Layout. It made CSS sensible to me.

By no means am I an expert, but I thoroughly enjoy writing CSS using techniques they teach in the book. Somehow, it helps me to think of CSS as a constraint programming system. Combinators are that --- layout constraint directives.

Architecturally, I really like the choice of pulling apart CSS in terms of structural definitions (Stack, Box, Switcher etc.), style definitions (applied to leaf nodes as far as possible), and global rules, ratios, and units (e.g. modular scale).

I think the system composes beautifully and lets me do a lot with a very small set of core definitions.

My personal site uses those techniques: https://www.evalapply.org/static/css/style.css

edit: formatting

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.