HTML and CSS are not Programming Languages

Perhaps you’ve heard someone mention that HTML & CSS aren’t really programming, but what exactly does that mean? After all, you use HTML to provide instructions to the computer, and a website is a type of computer program. Optically, someone sitting and writing HTML in a code editor doesn’t look much different than someone writing javascript.

Honestly, this is a bit pedantic, and for many that is a good enough argument to say that writing HTML is programming. However, there is an important technical distinction that to understand will take you surprisingly deep into computer science, specifically the field of computability.

HTML is a markup language, which means it is a language that provides syntax for annotating and “marking up” text. It can be used to signify that different segments of the text belong to a new paragraph, list or header. Notice, however, that there’s no way you could use HTML to write an algorithm to calculate the average of a set of numbers, or any other basic programming task. CSS is the same way.

As it turns out, to qualify as a “programming language”, a language must provide a minimum set of features: the ability to write variables, to have some form of control flow, the ability to emulate a finite state machine, and the ability to halt, or end. If you have those four properties, you are a programming language; If not, you aren’t.

This subject was first explored by Alan Turing, the father of computer science. The simplest machine that can satisfy these properties is known as a turing machine. If a language supports these features, it is called turing complete. Turing compatible languages have the interesting property that any set of instructions in one language can be translated into another. Amazingly, this means that in some sense, all programming languages are the same.

HTML & CSS are not Turing complete, and thus are not generally considered to be full-on programming languages. The newest version of CSS introduces support for variables, so it is on its way.

Don’t fret. Just call it “coding” instead and move on with your life!