Skip to content

Instantly share code, notes, and snippets.

View pieterbeulque's full-sized avatar

Pieter Beulque pieterbeulque

View GitHub Profile

This is a reply to @ppk's article "The CSS mental model"

I like the idea of explaining CSS to JavaScript developers using JavaScript analogies! I'm not really sure about the example you're giving, to be honest.

Would it make more sense to explain the declarative part as some code that runs on every frame to render the page again? Every part of a CSS selector then becomes either a loop or a conditional inside a loop. See below.

The given example (I dropped the :hover for reasons later explained)