The CSS mental model - QuirksBlog

PPK looks at the different mental models behind CSS and JavaScript. One is declarative and one is imperative.

There’s a lot here that ties in with what I was talking about at New Adventures around the rule of least power in technology choice.

I’m not sure if I agree with describing CSS as being state-based. The example that illustrates this—a :hover style—feels like an exception rather than a typical example of CSS.

Tagged with


The state-based description makes sense to me. I’ve argued before that selectors are if statements: If this description is true of an element (it has this class name, it is a descendant of that, etc.), apply these styles. :hover is not really any different than JS adding or removing a class.

# Thursday, January 1st, 1970 at 12:00am

ppk 🇪🇺

Well, apart from :hover and friends we have the form pseudo-classes such as :valid and :invalid. … which means we get back to links and forms, the original interactive elements …

Shane Hudson

Wow, nice reference to 2004. The power of keeping a blog eh.


# Liked by getify on Tuesday, February 26th, 2019 at 6:09pm

# Liked by Kamil Dzielinski on Tuesday, February 26th, 2019 at 6:41pm

# Liked by ppk 🇪🇺 on Tuesday, February 26th, 2019 at 6:41pm