Part 4 of 5

HTML and CSS together

HTML holds the state and CSS reads it and decides what follows. Together they can do real, if limited, computation, and the demos prove it.

Part 3 ended on a mismatch. HTML can hold state, such as a ticked box or an open section, but can't make decisions about it. CSS can make decisions all day, but has no state of its own. Put them together and each fills the other's gap: HTML remembers, and CSS decides.

Memory

A checkbox is a single bit of memory: it's either ticked or it isn't, and it stays that way until someone changes it. A group of radio buttons is a little more: one choice out of several, like a variable that can hold one of a fixed set of values. Labels let any part of the page flip them.

CSS reads that memory with :checked. Until recently it could only react in elements that came after the checkbox; :has() removed that limit, so now any part of a page can respond to any box on it. Here's the simplest possible example, a light switch:

The switch is a checkbox in disguise: the box is hidden inside its label, and the label is drawn to look like a switch. Clicking the label ticks the box, and CSS does the rest:

.bulb {
    filter: grayscale(1);
}

.room:has(#light:checked) .bulb {
    filter: none;
}

One bit of memory in HTML, one decision in CSS. Everything that follows is built from more of the same.

Counting

CSS counters, which part 3 used to print the results of sums, can also count ticked boxes, because a counter can go up only on elements that match a condition. The boxes are hidden inside their labels again, so you pick the labels themselves. Which of these HTML elements have you used?

.quiz { counter-reset: used; }
.quiz input:checked { counter-increment: used; }

.result::before {
    content: "You've used " counter(used) " of 8.";
}

That's input, memory, a calculation and output, with no script anywhere. Ben Romy wrote that HTML "can't take input and produce output". On its own, no; with CSS, it just did.

The demos

The demos push the same ideas further. Each one has its own page, with an explanation of how it works and the one thing it proves.

All the demos are also listed on the demos page, linked from the top of every page.

The limit, and how it moved

So can HTML and CSS together compute anything? For years, the answer was "yes, with help". Rule 110 is a row of cells, each on or off, where every new row follows from the one above by a single simple rule. In 2004 the mathematician Matthew Cook published a proof that Rule 110 can compute anything a computer can: it's Turing-complete. And Rule 110 has been built in HTML and CSS, notably by Eli Fox-Epstein in 2011; there's a version you can try in the demos.

That made HTML and CSS Turing-complete too, with two catches:

  • The page must be big enough. Every cell has to exist in the HTML before the page loads, so the size of the computation is fixed in advance. That's a lesser objection than it sounds: every real computer has a fixed amount of memory too.
  • A person has to keep clicking. CSS can work out what the next row should be, but with the CSS most of us write, it can't make it happen. Someone has to click to move the machine on, every step. The person is the clock.

The second catch shows up in a simpler way too. HTML and CSS are very good at checking an answer: is this game won, is this sum right, is this a valid move? Searching for one is another matter, because searching means trying something, remembering the result, undoing it and trying again, over and over. In every demo on this site, only the person clicking does that. A knight's tour is easy to check in CSS; finding one is left to you.

Then CSS got a clock

In February 2026, Lyra Rebane published x86CSS: an emulator, written in CSS, of an Intel x86 processor, the family inside most desktop computers. It runs real programs, written in C and compiled to x86 machine code, with no JavaScript at all. And it doesn't need anyone clicking: its clock is a CSS animation, combined with the newest kind of container query, so the processor steps forward by itself. It builds on Jane Ori's earlier CSS CPU, which needed the pointer held over the page to keep it running.

That removes the second catch. A processor that runs compiled programs can run one that searches, so in principle CSS can now find a knight's tour by itself. It also means CSS is carrying its own state from one step to the next, the memory part 3 says it lacks in everyday use.

The new catches are practical ones:

  • It needs the very newest CSS. x86CSS relies on if(), custom @functions and style queries, so for now it only runs in Chromium-based browsers, such as Chrome and Edge, and in Ladybird.
  • It's slow and small. It has 1.5 KB of memory to start with, its author says it isn't practical, and it doesn't support every x86 instruction.

Neither matters to the question of what CSS can do. Slow and small is how every computer started. The demos on this site stick to CSS that works in every browser, which is why they still need you to click; but the line they show isn't where it was.

How they score together

Against the four tests, HTML and CSS together come out like this:

HTML and CSS against the four tests
Test HTML and CSS Why
Computes anything Partly With a person clicking, they can run a machine that computes anything (Rule 110). With the newest CSS, an emulated processor runs by itself (x86CSS), but only in some browsers, slowly and in little memory.
Gives instructions Yes Both are instructions the browser carries out.
Decides and remembers Yes HTML remembers, in checkboxes and radio buttons; CSS reads that memory and decides what follows.
Builds programs Partly Games, puzzles and calculators, and even compiled C programs on an emulated processor; but nobody would build real software this way, or should.

That's a very different picture from either on its own. Together they pass the middle test outright, and get further on the strictest than most people would guess, further every year. Whether that's enough to call them a programming language is what the verdict is about.