I have a real distaste for this question. It might seem like a fun question to dig into on the surface, but the way it enters public discourse rarely seems to be in good faith. There are ulterior motives at play involving respect, protective emotions, and desires to break or maintain the status quo.
If someone can somehow prove that CSS isn’t a programming language (this is such a gray area that if that was your goal, it wouldn’t be terribly hard to do) then they get to keep on feeling superior in their “real” programming skills and rationalize the fact that they are (likely) paid more than a front-of-the-front-ender specializing in CSS. This is maintaining the status quo.
The reverse can also be true. If you can prove that CSS is a programming language, perhaps you can shift your own company or the industry at large toward equal respect and pay toward front-of-the-front-end developers. This is breaking the status quo.
Let’s say we could all agree on a boolean true
or false
on if CSS is a programming language. What now? If true
, is pay normalized among all web workers? If false
, do CSS specialists deserve pay cuts? If true
, does everyone start respecting each other in a way they don’t now? If false
, do CSS people have to eat lunch in the boiler room? I have doubts that anything will change; hence my distaste for the discussion at all.
Whatever the facts, it’s unlikely most people are going to accept even the possibility that CSS is a programming language. I mean, programs execute, don’t they? Nobody doubts that JavaScript is a programming language, because it executes. You write code and then execute that code. Perhaps you open a terminal window and write:
> node my-program.js
Sure as eggs is eggs, that program will execute. You can make “Hello, World!” print to the terminal with console.log("Hello, World!");
.
CSS can’t do that! Um, well, unless you write body::after { content: "Hello, World!"; }
in style.css
file and open a web page that loads that CSS file. So CSS does execute, in its own special way. It’s a domain-specific language (DSL) rather than a general-purpose language (GPL). In that browser context, the way CSS is told to run (<link>
, usually) isn’t even that different from how JavaScript is told to run (<script>
, usually).
If you’re looking for comparisons for CSS syntax to programming concepts, I think you’ll find them. What is a selector if not a type of if
statement that runs a loop over matches? What is calc()
if not a direct implementation of math? What is a group of media queries if not a switch
? What is a custom property if not a place to store state? What is :checked
if not boolean? Eric recently made the point that CSS is typed, and earlier, that CSS is chock full of functions.
For better or worse, having an answer to whether or not CSS is a programming language affects people. One college professor had made a point of telling students that CSS is not Turing complete, but is now re-considering that position upon learning that it is. Whatever the intention there, I think the industry is affected by what computer science professors tell computer science students year after year.
Lara Schenck has dug into the Turing-complete angle. If you’re trying to settle this, Turing completeness is a good proxy. It turns out that CSS basically is Turing complete (by settling the cellular automaton angle of Rule 110), just not entirely by itself. It involves a somewhat complex use of selectors and :checked
(surprise, surprise). Lara makes an astute point:
Alone, CSS is not Turing complete. CSS plus HTML plus user input is Turing complete!
Still, say you don’t buy it. You get it and even concede, OK fine, CSS is essentially Turing complete,
but it just doesn’t feel like CSS (or HTML for that matter) is a programming language to you. It’s too declarative. Too application-specific. Whatever it is, I honestly don’t blame you. What I hope is that whatever conclusion you come to, the answer doesn’t affect things that really matter1, like pay and respect.
Respect is in order, no matter what any of us come to for an answer. I don’t consider CSS a programming language, but it doesn’t mean I think it’s trivial or that my specialist co-workers are any less valuable than my Python specialist co-workers.
Wouldn’t that be nice? I think there is an interesting distinction between declarative markup languages and other types of languages, but they are all code.
Oh stop it, you know how thoughtful answers make me blush.
I’d like to see a lot more nuanced, respectful, and agenda-less comments like that when these discussions happen.
- Just like “website” vs “web app.” Whether or not you think there is a distinction, I would hope people aren’t making decisions that affect users based on what taxonomical bucket you think your thing goes in. ⮑
I attended Lara’s talk about this. It was one of the most delightful, hilarious, and informative I’ve ever heard.
A programming language is a formal language comprising a set of instructions that produce various kinds of output. While using CSS you can comeup with a variety of instructions for your website to respond to and the output is based on the instructions you input using CSS, the font sizes, the backgrounds and many more……
Therefore me I think CSS is a programming language
If you’re issuing instructions to a computer in a way that produces an expected output from a given input, then yes, you are in the classical sense, “programming”.
The problem with CSS is that it’s only useful for one task and doesn’t follow the same paradigms as any other programming language in broad use.
From a career standpoint, the narrow applicability of CSS means two things:
It’s likely to be automated or completely abstracted in the long term. (We’re basically seeing this with site builders, JS frameworks, and compilers.)
An hour invested in learning CSS is an hour invested in solving one particular problem that wont be applicable in other domains.
By contrast, JavaScript:
Is very similar to other programming languages. Moving from JS to Python for example is fairly trivial. As is moving from TypeScript to C#.
Is versatile in that solving a problem in client-side JS, for example form validation, will apply to other domains (entity validation in this case).
CSS devs do perform an important task, but an experienced CSS dev doesn’t have the utility that an experienced JS or a back-end dev does. That’s why CSS devs don’t have the pay scale or career mobility that other developers do.
At the end of the day though, you’re responsible for your career. You can still make a living with HTML and CSS, just be aware with the risks involved with specializing in a narrowly applicable technology with a low barrier for entry.
Quick addendum for clarity (Sorry for the spelling and grammatical errors in my original comment.):
Everyone deserves respect. CSS devs are developers. We all have the same 24 hours in a day, and CSS devs choose to use it in that domain.
Chris mentions Python. Python is considered a “general purpose programming language”, meaning that it isn’t intended for any one task. Java, C#, Rust, and C are also examples of general purpose languages.
HTML, CSS, and client side JS are widely used, but NOT general purpose. That’s why the tradeoffs in specializing in them are more stark than with other technologies.
Yes, CSS devs are important, but it does not have general programming concepts (does not mean CSS is easy), which is why most people wouldn’t consider it as a programming language.
Agree on the career mobility, kind of reminds me on over-complicated functions in Excel.
So your premise is that a cement truck driver isn’t really a truck driver because his truck can only be used for one thing?
No, as he could drive any truck. The skill is the driver’s license and not the truck.
It’s not. CSS is not a programming language, it’s a tool.
But it doesn’t have to be.
This topic pops up so often that I think that some people want to call themselves “programmers” but they only do CSS and are afraid that some people will laught at them cause of that or something.¯(°_o)/¯
NEWS FLASH
You don’t have to use “real” programming language to call yourself a programmer. You are still “programming” something.
Just do what you like, and call yourself how you like. Nobody cares, really, as long as you do your job well.
It’s easy to observe an abundance of tools in programming and related industries whose primary function seems to be protect my butt at any cost (I.M.H.O.).
I always liked Jeff Eaton’s take on this question, personally:
I disagree – both CSS and HTML are clearly “languages” in that they have formalized grammars. In my personal opinion, both are closer to markup on the languages spectrum, but of course that doesn’t at all mean they aren’t valuable.
To the “respect” point of the original post, I think it’s ridiculous that anyone would look down their nose at someone whose primary job responsibility is writing CSS. Styling is an essential element of any web project, no more or less important than the rest. I’ve encountered coworkers that scoff at the thought of writing CSS because it “isn’t real programming”, but also couldn’t do it if they tried. Those people usually tend to also be poor “traditional” programmers, coincidentally.
I don’t think it’s a traditional programming language, but the sh*t I’ve seen people do with it (e.g. https://codepen.io/neoberg/pen/istyp) certainly puts any skill I have in any of the “traditional” languages to shame.
There’s no reason why the person who can make that with only CSS shouldn’t make a fortune.
!important exists. This automatically qualifies it as a language
!important is an abomination
I think trying to prove that CSS is a programming language won’t solve the real issue. The real issue is that CSS developers are less respected and paid less than programmers, but it doesn’t have to be related.
I mean SQL is not a programming language either (it’s Query language, it’s in the name) and yet DBAs are among the best paid techs. Or look at project leads and upper management, they’re paid even more and some of them can’t even write a line of code !
IMHO it would be easier to convince people that writing CSS is a very complex task that requires highly qualified people even though it’s not a programming language, rather than trying to prove that it’s kind of a programming language if you look at it a certain way.
I work in a very progressive environment where full stack programmers rule the roost. I’m not a “CSS dev” and frankly had never heard that term until I read this post… however, the use case for CSS is to provide a human friendly interface for a set of functions and features.
Whether it’s CSS or some other method of styling (WPF styling model) does it really matter?
CSS provides a way for humans, even babies, to understand and visualise code without any previous understanding.
…
That said, almost all those full stack programmers know very little about CSS which makes me feel pretty good being able to answer some questions for a change.
CSS is more of a config file for the DOM. There are sections, directives and values. I think of CSS like I think of YAML, XML and JSON. It doesn’t have a runtime and can be used by other languages on many different runtimes.
I code in Angular 11 everyday in my job. CSS(SCSS) is just a styling part of the component. HTML is just the template structure. TypeScript contains all the logic of the component.
Who cares if CSS is a programming language or not. HTML, CSS and JavaScript are powered together.
I secretly miss DSSSL and even XSL a little. That’s the context this question comes up in for me. Without CSS tricks, flexbox, and SVG, turning an idea into reality with CSS is like writing high-availability web apps in 6502 assembler: you can do it, but it doesn’t seem to make any sense. But with xslt and xsl-fo it’s a Simple Matter of Programming. Even easier for DSSSL, which doesn’t have the sort of information leaks we’ve seen in CSS.
A programmer is someone who writes instructions to be executed by a computer. Machines are able to execute python instructions, same way machines execute css instructions.
So to me. Css is a programmimg language. Just that it may not be explicitly known as one.
Programming languages can fall into two different paradigms: declarative and imperative.
Traditional languages like C++, and Java fall under the imperative paradigm. You’re telling the computer each step. You’re essentially controlling the flow of the program and focus on “how” it executes.
Declarative languages you describe “what” you want the result to be without dictating each step. DSLs are a subcategory of these declarative languages. They do not need to be touring complete.
CSS is a declarative languages that describes the visual aspects of the web page. You’re not telling the browser step-by-step how to change the background to blue, You’re just telling it that this thing needs to be blue. Hell, CSS has a formal grammar describing its syntax as well as tokenization and parsing rules.
I’ve personally never heard anybody argue against CSS being a programming language.
I don’t understand how it can’t be a programming language! I absolutely hate the elitism and toxicity that this industry produces. It doesn’t matter – we’re all technical people who are capable of solving problems with the tools in which we understand.
Respect and pay are more sensitive to economic realities of supply and demand than the apparent complexity of the tool. If you are trying to address those issues you are facing a mass prisoner’s dilemma problem.
Let’s face it. The programmer community in general is made up of bigots and narrow minded individuals. I base this from nearly 10 years in the industry. The arrogance and tribalism is something not many people talk about in public but it is definitely in most places
I don’t understand why there’s debate about this. Of course it’s a programming language. But for the sake of clarity on why I say “of course”, I’ll try to address the qualities that people may use to say otherwise (many expressed in earlier comments on this article):
It doesn’t have general utility (it’s not “general purpose”). This is true of many languages. CSS addresses a specific problem domain and very seldom is used for problems outside that domain. This is known as a Domain Specific Language (DSL). Other DSLs include: Regular Expressions, SQL, Processing, JSX.
It’s (mostly) declarative. Most people think of programming as instructing a computer to “do” something (imperative programming) or formulae to calculate some result (functional programming). But again, there are many declarative programming languages, such as: Prolog, Regular Expressions, SQL, JSX. And as I said, it’s mostly declarative. Like SQL, it also has functions. And like SVG, it can declaratively initiate autonomous state changes (animations).
It has a (mostly) static API, with limited ability to add new functionality. Currently there are two exceptions: custom properties allow novel composition, and Houdini which allows arbitrary novel functionality. Granted Houdini requires a JS implementation. But it’s conceivable that a subset could find its way into CSS just as a subset of Shadow DOM is coming to HTML.
I can’t think of any other objections to CSS-as-programming-language that aren’t based primarily in elitism. And to the points raised in the article about value (equal pay and respect), that elitism is harmful. But more importantly it’s unfounded.
Implementing even trivial designs in CSS can be incredibly complex. Developers have to account for: an ever growing matrix of device sizes and capabilities; a wide variety of accessibility and usability challenges; a never ending churn of browser quirks and incompatibilities; the same sort of tooling sprawl JS devs deal with.
What’s more, it’s a common trope for developers without frontend experience to lament the challenges they face when dabbling or tasked with frontend work.
CSS isn’t a Turing complete programming language, done. It is a language, with less capabilities than a full Turing complete language. But this doesn’t mean it is less valuable, you won’t use a swiss knife to screw in a screw, but you could and it would be terrible. However you can’t cut a piece of cheese with a screwdriver. This doesn’t mean the screwdriver is useless or lesser or whatever.
Using computational power definitions as Turing completeness are useful, but it isn’t a judgement of value.
Flip a binary tree in css
Tree.rotate(180deg)
Boom
I know how very tempting it is to have an opinion about something you have only scratched the surface. There is a reason why not everyone knows how to write CSS code well. It can get very complicated like all programming languages. You can use functions, variables, and create grids that takes weeks to build out properly. So, if you are a programmer having issues building out CSS grids from scratch, then I have to ask is it a programming language or not?
Once you add-in preprocessors such as SASS or LESS, suddenly CSS becomes more complex and must even be compiled before using in the client. With that, it sounds even more like a programming language.
I don’t know that I care if css is called a programming language or not.
What I do care about is people who ONLY know how to write some html and add bootstrap making it seem like they’re qualified to do things like architect a whole system backend and frontend. Or that CSS carries over to other types of languages. like “You’re a programmer? awesome, we need you to write something to parse these billing records”
Look what I’ve made with just css: https://github.com/avisek/No-JS-Noughts-And-Crosses
Great read, I always asked this jokingly because of its robust features and reliability.
I just don’t like it when folks make it look like CSS is less relevant because it isn’t a programming language.
This is akin to asking if a virus is alive because it cannot reproduce on its own.
I think we can all agree it doesn’t matter because both a affects us deeply and executable or self-replicating isn’t actually what’s important in the end.
It’s about what is affected by the thing itself and at what level.
I also think this is probably the only era you can compare CSS to a bio-virus without feeling you’re overreaching ;-)
Can’t say css isn’t also can’t say css not… I think on middle (more near to advanced) way yo be a program language.
I’m a CSS hobbyist. I was drawn to CSS because it allows me to design attractive documents and UI’s. At least the way I use it is not a programing language since it is strictly presentational. Someone from Monzilla made a video about CSS in which she said that it was much more linguistic than logical. In other words it is much more about telling the webpage or app how to look than actually doing anything computational. Perhaps we should call it a presentational language?
CSS is not a programming language. Full stop. It was not designed to be used to write programs, nor is it easy or useful to do so. It is no more a programming language than any other language with accidental Turing-completeness. Let’s not waste time debating something so pointless.
Like F.Z. would have said:
“It doesn’t, and you can’t, I won’t, and it don’t
it hasn’t, it isn’t, it even ain’t, and it shouldn’t
it couldn’t”
Nice article. But the question is CSS a programming language or a tool, that will carry on. So not further wasting time on that, I would say overall the article was good, and will be keen to see more blogs from your end. Okay TC and stay safe.
This is an interesting conversation. Im a full stack developer, i’ve never considered the time i’ve spent in CSS to be worth any less (or take less skill) than the time i spend in JS or c#. I do wonder how one could make a full job of CSS/HTML but the skills some people have in this area are impressive
Turing completeness should certainly not be used to determine if something is a programming language or not. There are non-turing complete languages out that are designed to guarantee that a program terminates. And, there’s also software like PowerPoint which is turing complete. Am I using a programming language every time I make a presentation?
Turing completeness is a definition of all functions that the language can calculate. This is no measure of speed/performance. Using this is useful to understand the capabilities AND the pitfalls of a language. Yes there are some languages that are less expressive than Turing complete languages and for example guarantee to get into a finishing state after a finite set of steps. They have their place, but it is useful to know they aren’t Turing complete. The question ‘is x a programming language’ first need to get a clear definition.
No matter if CSS is or is not a programming language. That’s not the point. Just go back to the Age of Stone Web when you had to nest tables within tables and style markup just directly into the html code and then you will se how valuable is that CSS which have allowed us all to build easily and beautifully html stuff.
I pay the deserved tribute to the CSS people because they are the ones who make up the code for accessibility, usability and the like.
Imagine a web stuff with out CSS and try to use it.
That’s the most important thing to discuss in this, the value of the people who CSS it for us.
Programming Languages … exist to program Machines.
Whether that be a Jacquard Loom or a Mainframe computer.
In an electronic computer, the only “real” programming language is (the appropriate) Machine Language. Because, at the end, that is what actually executes.
Everything else is an abstraction. Even Assembler is an abstraction, though not very far removed from Machine Language.
So, the simple test of whether something is performing the action of “Programming”, is whether it turns into Machine instructions?
The question of “Language”, is a different question, which I am avoiding here.
CSS -> Browser Runtime + OS -> Machine Language = Execution
CSS is a “Programming” Language.
We are so far removed from the relationship to the physical state, that we fail to even understand the degrees of abstraction we are speaking of.
While we can argue the qualities of different levels and kinds of abstraction, most of what we are engineering computer languages for is the guidance of humans. Abstractions help humans to think. CSS is easier to think about for graphical programming than C graphical routines. Or, at least, faster. Trying to think through graphical programming from the perspective of assembler is even more work.
This is why DSLs are useful. They help us to formulate specific outcomes on the computer, in a way our brains can comprehend.
Additionally, programming languages help us avoid having to deal with hardware differences. Those are hidden by the Operating System (OS) and the programming languages we use.
A final point to make. If you think you are using real programming because you use Javascript, or GO, you are missing all the work that is being done for you by the people who built the things underneath your code. Do you know how to write a Compiler? Do you want to spend all of your time writing a Compiler instead of writing some code that glues together network calls? All of your function calls are set up by systems that have taken years to evolve.
Perhaps we might just enjoy the part of the process we enjoy, and respect others for enjoying their part of the process?
Sadly, getting paid is more related to perceived difficulty.
Javascript looks hard to a non-developer.
CSS just makes things look Green or Blue, how hard can that be?
The more visible the outcome of your work, the easier it is for people to think they can do it themselves.
(That’s something I learned as a Front End Developer. Anyone who passed my station would feel comfortable “critiquing” my work. But nobody wanted to even talk to the back end developers, for fear of looking foolish.)
I share your distaste for the question because it is utterly academic, and like most academic questions, it just leads to debates which have no impact in the real world. I’m an old web engineer — started with HTML in the ’90s, then learned JavaScript. Started with CSS in the early ’00s, and grew to love its combination of power and simplicity (and that I didn’t need to use the Adobe suite as much!). While I was building sites/apps for customers in those early days, I never once pondered whether it was a programming language because what you call it has no bearing on how you use it (let the philosophical debates on that point begin ).
This kind of debate is a reflection of an unfortunate aspect of human nature: the desire to be “right” and to be perceived as knowing the “right” answer. Rather than spending time debating this inconsequential question, I’d encourage people to just read the specs/docs and practice using CSS to get better at it. Regardless of how one classifies CSS, there is still a dearth of engineers who know how to use it effectively/efficiently, at least IME.
TLDR: CSS can’t compute all functions a Turing machine can, and is therefore not a turing complete programming language. Interestingly CSS in combination HTML are.
I came to this blog post hoping to find if CSS is a programming language. I eventually found that information. However, I have no clue why it is presented with an annoyed with academia attitude. Programming languages are normally considered languages that are Turing complete. CSS isn’t, done. It doesn’t take away the fact that CSS isn’t very valuable and difficult to master.
And to your statement that you can’t prove CSS isn’t a programming language (defined as a Turing complete language), you perfectly can.
I have no idea where this hurt attitude comes from towards academia, but it is still important to understand the different formal definitions for programming languages and research how we can make this better.