Lyra Rebane's x86CSS Emulates a Simple Intel x86 Computer In-Browser — Using Only CSS

Cascading Style Sheets demonstrate their Turing-completeness in this clever emulator project — no JavaScript required.

Gareth Halfacree
1 day agoRetro Tech

Developer Lyra Rebane has created an emulator for a basic Intel x86-based computer with a difference: it runs in-browser and was written entirely using Cascading Style Sheets (CSS).

"x86CSS is a working CSS-only x86 CPU/emulator/computer. Yes, the Cascading Style Sheets CSS. No JavaScript required," Rebane explains of the project. "There is a script tag on this site, which is there to provide a clock to the CSS — but this is only there to make the entire thing a bit faster and more stable. The CSS also has a [JavaScript]-less clock implementation, so if you disable scripts on this site, it will still run. JavaScript is not required. This entire CPU runs in just CSS and doesn't require any HTML code, but there is no way to load the CSS without a <style> tag, so that much is required."

This functional x86 emulator is written entirely in Cascading Style Sheets (CSS) — no JavaScript required. (📹: Lyra Rebane)

The Cascading Style Sheets (CCS) language was released back in 1996 by the World Wide Web Consortium (W3C), based on proposals by Håkon Wium Lie and Bert Bos for providing a way to more easily control the stylistic elements available in the HyperText Markup Language (HTML) and to separate presentation from content. While adoption was slow and buggy at first, CSS has become the de facto standard for styling websites — alongside JavaScript for creating dynamic content, which is executed client-side within the browser.

Rebane's emulator, though, doesn't require JavaScript; instead, it proves that CSS, despite having been created as purely a style sheet language, is Turing-complete in itself. "Is this practical? Not really," the developer admits, "you can get way better performance by writing code in CSS directly rather than emulating an entire archaic CPU architecture. It is fun though, and computers are made for art and fun!"

You can try the emulator yourself in Chromium-based browsers on Rebane's website; a more detailed write-up of how it was achieved is in the works. The source code, meanwhile, is available on GitHub under an unspecified open source license.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles