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!

Latest comments (94)

Collapse
 
louislow profile image
Louis Low • Edited

How do you like my joke?

<style>
  if[state="true"] > return { color: blue }
  if[state="false"] > return { display: none }
  if[state]:not([state="true"]) > return:after { color:red; content: "Invalid Boolean!" }
</style>

<if state="true">
  <return>
    Hello World!
  </return>
</if>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
themoviemadman profile image
Eliseo D'Annunzio

Loouis, that is actually quite logical code there!

You may want to change:

if[state]:not([state="true"])

to

if[state]:not([state="true"]):not([state=“false”])

Collapse
 
naamanews profile image
News Naama

Yes, I read many articles is Html a programming language HTML is a programming language “HyperText Markup Language” which is the most basic building block of the web page.

Collapse
 
cryptoquick profile image
Distributed Hunter Trujillo

Of course CSS and HTML are programming languages. Aside from discussions of computational theory, such as grammars, Turing-completeness, expressivity, etc... Even assembly instructions sent to a CPU are just configuring the target to run certain functions.

Besides, they have a formal spec. HTML has the word 'Language' in the name, for goodness sake!

Collapse
 
holywar20 profile image
Bryan Winter • Edited

Technically, they are.

But this is more a question of human language than a technical question. If your only skill is HTML, you can't call yourself a programmer in a human setting talking to other humans without other humans thinking that your a liar. Likewise many designers know only only HTML and CSS, and while they are often quite bright people doing extremely valuable work , they don't consider themselves programmers, or what they are doing programming.

This is less about gate-keeping, and more about how technical and human idioms don't map exactly on each other.

Collapse
 
holywar20 profile image
Bryan Winter • Edited

I remember reading an article about a guy who made a complete RPG in excel.

Excel scripting is Turing Complete.

Collapse
 
raddevus profile image
raddevus

Consider this: Computer programming is about automation (computer automation).
So when someone says, programming language a set of people think, "Hmmm...this must be a language that enables automation."

HTML is defined as a markup language and doesn't contain language elements to enable automation directly.
You can see this at work because later, people who were working in static HTML came up against its limits. That's when Brendan Eich of (then) Netscape created JavaScript and added it to HTML (browser's really) to enable automation (dynamic content).

Now, of course, many people will say, HTML allows the automation of static documents. It allows browsers to render a document and that is a kind of automation.
So, this is the real distinction and why certain people hear someone say HTML is Programming Language and balk, because it doesn't really enable automation the way they feel a programming language does.

Collapse
 
khrome83 profile image
Zane Milakovic

It better be... I tell people I am a programmer. Don’t take this away from me!

I do other languages, but HTML and CSS are the ones my non programming friends can relate too. Almost all of them have had a elective that has used it in some level of college or high school.

Collapse
 
jasperhorn profile image
JasperHorn

I know this post is pretty old, but this site keeps linking me to it and since I disagree with the bias in the question, I get the urge to write a response every time. I finally gave in.

No, I don't think html and css are programming languages. I also don't consider it gatekeep-y to say this. That's because I don't think they're less than programming languages, and saying they aren't programming languages changes that. Well, saying it out of the blue may imply that they're less, so that can be gatekeep-y. Saying it when the question is whether they are programming languages isn't. Neither is saying it when asking someone for their programming experience in order to determine the level at which you're going to explain them about something (though I'd probably make it "aren't really programming languages").

I consider programming to be about instructing a computer what to do. I do realize that html and css together are often seen as a way to tell the computer what to display on the screen (where displaying on a screen is definitely a subset of doing) but I don't think that's what they are really about. Html is about giving structure to a document. A good html document can be read by a screen reader which doesn't display things at all. Css is about establishing how you want your structures to be displayed. Good css has very little specific to a single page and has a lot that can be reused. It's more about adding your style to your site than about telling the computer what to put on the screen. At least in theory, in practice it's often less clear-cut.

Personally, I do both write html & css and program in what I consider programming languages and I like both. They feel like different activities to me, though. The difference between programming in one language and programming in another language is much smaller in my opinion, even when the one language is imperative and the other is functional.

I do have one experience writing css that felt like programming, though. I was using very recursive css to display a family tree. However, that was not at all a way in which css is typically used, I feel it was more coincidence than intentional that css could do this at all and it was not at all how it is meant to be used. The result was still really awesome, though.

Collapse
 
pentasis profile image
Bert

I'm late to the discussion but I always considered HTML and CSS scripting languages. A program is code that results in an application (user interaction), and a script is code that is used by an application (to perform a task, change or add functionality).
HTML and CSS are code used by an application (browser/server) to provide an interface.
So are HTML & CSS Programming languages? Imo no, they are Scripting languages.

Collapse
 
jhall profile image
Jonathan Hall

The answer to the question depends entirely on your definition. They are both languages, obviously. So the question is whether writing CSS and HTML constitutes "programming."

Neither is Turing complete, so a strong argument can be made that they are not "complete" programming languages. But there are other programming languages that aren't Turing complete, too.

At the other extreme, a programming language may be defined as any language that allows you to specify instructions to a computer. In the broadest sense, these languages do that, although they're more declarative than imperative, which may matter to some definitions.

In the long run, the only way to answer the question is according to a specific definition. There is no universally correct answer.

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