Putting JavaScript in CSS

Putting CSS in JavaScript is pretty much the norm these days - but what if we could do the opposite? Recently, I've been reading quite a bit about Houdini, which gives developers the ability to directly interact with the CSS Object Model.

One of the coolest things about it is that it lets us put JavaScript in our CSS. In the example below, I've created a background effect where the JavaScript is inside the CSS. Every time you refresh, the background is randomized. Check the CSS tab below to see JavaScript inside the CSS.