DEV Community

Cover image for Are CSS and HTML programming languages?
Desi
Desi

Posted on

Is CSS a Programming Language Are CSS and HTML programming languages?

Inspired by a recent Twitter thread (and long-running debate anyway): are HTML and CSS programming languages?

Is it gatekeep-y to say no?


The answer is yes, it is gate-keepy, but go off

Discuss!

Top comments (94)

Collapse
 
ben profile image
Ben Halpern

Yes, CSS + HTML are programming languages. Not only is this scenario technically Turing complete, I think these software fit a lot of the principles of the purpose of programming languages: source code in, magic out.

You can create some of the most incredible things coding html against a browser. No, it’s not as flexible as another programming language in terms of practical possibilities, but it’s a highly specialized language for doing really interesting things.

Distinguishing between programming languages and markup languages when nobody asked you to is unnecessary gatekeeping. If you want me to talk about that distinction, than sure.

The notion of what makes computers go bleep and bloop has always been under re-construction. If you could possibly debate whether something could be a programming language, you might as well call it a programming language because.

Collapse
 
deciduously profile image
Ben Lovy • Edited

Yes, it's "source goes in, magic out", but still constrained to a specific context. The type of magic that comes out, while very cool and very vast, is still a small subset of the magic that can come out of something more general-purpose.

I don't understand why it's gatekeeping to acknowledge this distinction. I don't agree that calling something "not a programming language" makes it "lesser than a programming language", but just helps us understand in more specific terms what the tool is and isn't. Why is using multiple categories of language when we talk about our tools dismissive?

Collapse
 
calebwin profile image
Caleb Winston

I agree - good categorization of the languages we have is important.

I think the real problem is when people think or act as if they are superior to others because they know a certain language or category of languages and others don't.

Thread Thread
 
deciduously profile image
Ben Lovy

Of course - those people don't tend to be worth your time anyway.

Thread Thread
 
ben profile image
Ben Halpern

I agree, but I think it’s more truer that markup languages are a subset of programming language vs a different category.

And in this case I think the gatekeeping comes into play when the topic of whether or not these things are programming languages is somewhat unimportant.

So whether the answer is yes or no, pointing it out when it’s unneeded for the conversation is gatekeeping, or could be perceived that way in our imperfect online lack of tone translation.

In a sense, the true gatekeepers have ruined it for anyone coming in with good intentions.

Thread Thread
 
deciduously profile image
Ben Lovy

it’s more truer that markup languages are a subset of programming language vs a different category.

The rest of this thread has me convinced of this as well now.

pointing it out when it’s unneeded for the conversation is gatekeeping

I agree, but in this case it was the conversation! You've got a point, though, the people with emotions about this sort of thing aren't usually coming to these discussions in good faith but for some sort of one-upmanship. At the end of the day, of course it doesn't actually matter - just build things. I still think it's useful to classify languages like this, in the interest of making well-informed choices about the right tool for the right job, but that sentence is so uncontroversial I don't imagine anyone disagrees.

Thanks for your response!

Collapse
 
stephanie profile image
Stephanie Handsteiner • Edited

Yep, they're declarative programming languages, you can tell the browser what it should do, but you can't tell the browser how it should do it, for that you need an imperative language (whichever one chooses, I'm not going to open this can of worms now).

Collapse
 
toastking profile image
Matt Del Signore

I think the new hot take should be that prolog isn't a programming language.

Collapse
 
skhmt profile image
Mike 🐈‍⬛

Is markdown a programming language?

Collapse
 
desi profile image
Desi

That's another great point! IMO, markdown is not a programming language because it's more for styling text - but that's me coming from a writing background and now I'm thinking about how markdown functions and is built. It's more complicated than I thought at first 🤔

Thread Thread
 
deciduously profile image
Ben Lovy

Seems to me you're rubbing up on the same issue as with HTML. It's a markup language used to program how to generate some output!

Collapse
 
togakangaroo profile image
George Mauer • Edited

Odd that no one has pointed this out

Everyone is focusing on the "language" part, which without a doubt CSS and HTML are. But what about the "programming" part? Well we don't have a definition there so that bit is a lot more difficult. It becomes a matter of what we "feel" like that term means to us.

At the base level it means making a system do what you want it to do. Of course in that case, so is writing an excel spreadsheet, or drag-and-dropping, or customizing your OS with new colors, or creating a new web app account, or even just calling up IT and telling them to fix things "or else".

That feels wrong.

For some, "programming" means "general-purpose programming"- that you not only can, but realistically might, sit down and code some algorithms in it. In that case sure, HTML and CSS are not programming, and neither is Brainfuck, or Arnold, or the more basic usages of Prolog.

You can't really fault those people for being bewildered at the resistance to what to them seems like such an obvious statement. For them, "HTML and CSS are not programming languages" is not gatekeeping, it's an attempt to educate on what seems to them to be an important distinction.

So why can it be so upsetting to hear it?

I suppose there is another definition we can go with: "Things that might be a central part of the job for someone who works professionally as a programmer". In that case, not only of course are HTML and CSS programming, but hearing that phrase - for someone who is primarily engaged in HTML and CSS - sounds like a denial of their entire career and track.

Conclusion? Maybe we all need to be aware when using terms without strict definitions that they might mean different things to different people.

Collapse
 
jhall profile image
Jonathan Hall

By this logic, SVG, PDF, and arguably even JPEG are programming languages.

Collapse
 
itsjzt profile image
Saurabh Sharma • Edited

is HTML and CSS turing complete?

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

Yes, they are.

There's no legitimate definition of programming language you can give that would exclude them. I consider any unambiguous language used to control a computer to be a programming language.

Even with narrow definitions, generally HTML and CSS will both fit them, if strained hard enough.

Collapse
 
deciduously profile image
Ben Lovy

This was a great read. I think you've changed my mind, thank you for posting it.

Collapse
 
gn4rk profile image
GN4RK

HTML is a "[M]arkup [L]anguage".
CSS is a "[S]tyle [S]heet language".
SQL is a "[Q]uery [L]anguage".
JavaScript is a "Programming language".
HTML, CSS, JavaScript and SQL are "Computer languages".

Collapse
 
lesha profile image
lesha 🟨⬛️

Why are ppl so obsessed with this question and why is this gate-keepy?

Look, let's say that neither HTML nor CSS are programming languages. So what? Seriously, so what?

Let's assume that you make absolutely static websites using plain HTML/CSS. What now? Well that means that you're not a programmer, but a web designer. Is it worse? I think it isn't.

If you're angry about some dude that says stuff like "html and css aren't real programming languages" on random twitter threads, why do you even care? He has his opinion, you have yours.


Answering this question, yes, HTML and CSS are programming languages because they're turing complete, if you do that stuff, otherwise no. Setting text color and typeface is not programming.

Collapse
 
angeliquejw profile image
Angelique • Edited

Front-end skills are not as valued (in terms of esteem and salaries) as back-end skills. This has real-world consequences and isn't just the stuff of Internet fights.

Collapse
 
desi profile image
Desi

Agree. I think that a lot of people who are so vehemently on the "HTML/CSS ARE NOT PROGRAMMING LANGUAGES!" side don't see that, and don't understand why the question (and thier response) matters in the first place.

Collapse
 
lesha profile image
lesha 🟨⬛️ • Edited

not as valued (in terms of esteem and salaries)

Should they? If so, why? What are your arguments? In my company, iOS dev is valued 1.5x more than web dev. Can we argue that I (the latter) deserve the same salary as the iOS guy? I certainly would like that.

What makes you equalize web dev and web design? Do you think that if you write in every book that "CSS and HTML are programming languages" something would magically change?

Thread Thread
 
angeliquejw profile image
Angelique

What makes you devalue front-end skills?

Thread Thread
 
lesha profile image
lesha 🟨⬛️

What makes you think that I'm devaluing front-end skills?

Collapse
 
moopet profile image
Ben Sinclair

I think that's changed in recent years. Nowadays, front-enders need to know a lot more than they used to, and get a lot more respect in the industry.

Collapse
 
moopet profile image
Ben Sinclair

I think whether people are hung up on it depends on the context. I haven't looked up the thread from the tweet in the post, but I can make some prejudicial assumptions about it based on the style and who got tagged in. That makes it look gatekeepy. A similar comment on a different thread might not be.

I want to take it down to a contrived litmus test:

If someone said they wanted to be a robotics engineer, and wanted to start out with an easy programming language and asked for suggestions... well, I don't think anyone's going to go with HTML or CSS.

Not because there're better alternatives available. Most of use would discount them because they're not the same type of language we all associate with programming things; we'd certainly bring them up if the asker was interested in making a website for their robotics project.

So I think it's not cut-and-dried. Depending on the scenario they are or are not "programming" languages, and as long as people aren't using that distinction to put other people down, then whichever definition's ok.

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦 • Edited

No Twitter hot take will ever match the subtlety and wisdom of these interviews.

You're absolutely correct that it is gate-keepy (and douchebaggy) to tweet that HTML isn't a programming language.

A better argument against these people, IMO, is that they're just factually wrong.

Collapse
 
t_w_lee profile image
Tim Lee

I was going to be super frustrated that I scrolled through this thread, not really learning a lot, until I came across these vids and channel. Ty!

Collapse
 
desi profile image
Desi

These videos are fantastic! Thank you so much for sharing!

Collapse
 
desi profile image
Desi

(cc @peter on this for consideration for next week's best comments post!)

Collapse
 
jmplourde profile image
Jean-Michel Plourde

I've read from some sources that CSS3 + HTML5 is Turing Complete. Someone with the nickname elitheeli proved this with a demo of a Rule 110 cellular automaton which is Turing complete. There is not javascript involved, just a html and css which is quite surprising when you open the repo.

Collapse
 
deciduously profile image
Ben Lovy

While very cool, isn't this an argument against? Neither language is Turing complete on their own, only in combination.

Collapse
 
stereobooster profile image
stereobooster

Simply typed lambda calculus is not Turing complete either...

Thread Thread
 
deciduously profile image
Ben Lovy

Right, because (as I understand it) you always get to normal form and terminate. It's not exactly a programming language either, though, right?

Thread Thread
 
stereobooster profile image
stereobooster

Right, because (as I understand it) you always get to normal form and terminate.

Yes. Expressions in typed lambda always terminate (you can't create Y-combinator, for example).

It's not exactly a programming language either, though, right?

Why not? It's not very comfortable to use, but you can write a program in it, to calculate something

Thread Thread
 
deciduously profile image
Ben Lovy

Heh, fair enough :)

I guess my eventual conclusion is that I'm wrong, it doesn't make sense to delineate HTML and CSS as something different, but also as others have noted that the distinction itself isn't all that useful. Calling something one category has no bearing on what you can or cannot do with it.

Thread Thread
 
stereobooster profile image
stereobooster

Scientific approach - given enough evidence one changes opinion

Thread Thread
 
deciduously profile image
Ben Lovy

Gotta love a good ol' fashioned discuss!

Collapse
 
jmplourde profile image
Jean-Michel Plourde

You are right and I feel the same. They aren't Turing complete on their own, only when combined. I'd have to look more into it.

Collapse
 
stereobooster profile image
stereobooster • Edited

Yes. They are "Descriptive declarative programming".

We define programming, as a general human activity, to mean the act of extending or changing a system’s functionality.

e.g. any language which can be used for "extending or changing a system’s functionality" is programming language. You have empty page in the browser if html file is empty, you add some tags, and page has some new behaviour, you changed behaviour of the "system". Congrats you did the programming.

The principal programming paradigms

Collapse
 
leoat12 profile image
Leonardo Teteo

No, they are not. That's why Javascript exists, a HTML page without a true programming language is as static as an image, there is not control flow or any dynamism like other programming languages.

Collapse
 
alvaromontoro profile image
Alvaro Montoro

You can have control flow in HTML and CSS by using radio buttons (and event without them). You can create a FSM/automaton with HTML and it will work as well as with JavaScript. It may not be practical, but it can be done.

Collapse
 
leoat12 profile image
Leonardo Teteo

I understand that you are talking about like changing the style of something based on the radio button, right? Together they can do such thing, but each one of them cannot be considered a programming language, HTML or CSS alone cannot do much as far as I know. Unless a FSM/automaton can be done exclusively with HTML, can you tell more about it? I didn't know about that.

Thread Thread
 
alvaromontoro profile image
Alvaro Montoro • Edited

That's a good point. A FSM/automaton could be built using only HTML with links and IDs/anchors... Again, it wouldn't be practical or pretty, but it could be done. But then someone will claim that it is really a simulation, or that they don't like it.

Thread Thread
 
johncip profile image
jmc • Edited

I help out with an after-school program where, early in the curriculum, we teach the students to make HTML "choose your own adventure" games. (I made this one). It's useful for that, at least :P

(We use separate pages rather than links to fragments on the same page.)

And they are roughly like FSMs, though I think of FSMs as having an input vocabulary that's separate from the states. For instance, with a dial-type combination lock, you can pick any number on any step. With a tree of links, you can think of each page's links as representing a 0, a 1, etc., but it's not "the same" 0 leading out of each page. (You can link to the same destination from multiple places, but that's just going to the same state.) Hopefully I'm making sense. Maybe that lack of a separate input vocabulary just means they're more like Mealy machines than Moore machines? I'm not sure.

They also feel like decision trees to me, FWIW. It could be that there's some formal correspondence between the two concepts, but it's sadly not my area :P

You may be interested in the HTML/CSS game The Mine -- the top code comment makes it sound like it might just be a big FSM made out of checkboxes. I haven't tried to confirm that though.

Thread Thread
 
alvaromontoro profile image
Alvaro Montoro

That’s what I was referring: each page is a state, each link is a transition, and the input is the user clicking on a link. And that can be achieved with HTML even without CSS. (Although CSS will make it prettier 😊)

Collapse
 
gypsydave5 profile image
David Wickes • Edited

Can we try shifting the argument, as the dance around Turing completeness is always naff and boring. Let's ask a better question:

Do you perform the act programming when you write CSS and HTML?

And I'd say it depends.

For instance: I've written configuration files in Groovy (which is probably a programming language), and I wouldn't say that was programming. I've written an interpreter for a (sub set) of the English language - is English a programming language? When you write a Google search, is that a programming language? When you ask Siri a question, is that programming?

This whole "is x a programming language" - it's too essentialist for me. There's nothing inherent in a language that makes it a programming language until you write it and it's interpreted by a computer.

Whether a language is a programming language is an effect of what it does to a computer. That's a matter of intent for the writer, and a matter of how it's interpreted by the computer.

Collapse
 
georgecoldham profile image
George
Thread Thread
 
hibritusta profile image
Hibrit Usta

Amazing :)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.