Changing CSS with CSS?

Would a browser reevalute its creation?


I woke up today wondering if I could add CSS code with CSS.

This idea requires inline styles. They flourish between the opening and closing tag of the <style> element. Contrary to the void <link rel="stylesheet"> element, we can add pseudo-generated content to inline styles. Let’s put valid CSS in the content declaration, like so.

style::after {
	content: 'span { color: red; }';

My gut feeling was No, this couldn’t possibly work!, but I had to put it to the test. So I tried it out on CodePen. Spoiler alert: In all the browsers I’ve tested, the answer is …