Table of Contents
"HTML is a markup language, not a programming language"
"HTML has no logic"
"HTML is not 'Turing-complete'"
So, is HTML a programming language?
Home Web Front-end CSS Tutorial HTML is Not a Programming Language?

HTML is Not a Programming Language?

Mar 21, 2025 am 09:52 AM

HTML is Not a Programming Language?

HTML is not a programming language.

I have heard this sentence countless times, it is boring. Often, it's followed by words like "it has no logic" or "it's not Turing-complete"...so, obviously it's not a programming language. It seemed as if things were over and the discussion should stop.

But should it really be like this?

I want to explore the arguments I often hear to devalue HTML and make my own rebuttals to show that these statements are not entirely correct.

My goal is not to prove that HTML is or is not a programming language , but to show that the three main arguments used to claim that it is not a programming language are flawed or incorrect, thereby invalidating the conclusion from a logical point of view.

"HTML is a markup language, not a programming language"

The statement itself sounds good…but it is wrong: a markup language can be a programming language. Not all markup languages ​​are (mostly not), but they can be. If we draw a Venn diagram of a programming language and a markup language, it will not be two separate circles, but two slightly intersecting circles:

A markup language that uses variables, has control structures, loops, etc., or may be a programming language. They are not mutually exclusive concepts.

TeX and LaTeX are examples of both markup languages ​​and programming languages. Developing with them may not be practical, but it is possible. We can find some examples online, such as the BASIC interpreter or the Mars rover controller (which won the jury award in the 2008 ICFP Programming Competition).

While some markup languages ​​may be considered programming languages, I'm not saying HTML is one of them. The key is that the initial statement was wrong: the markup language can be a programming language . Therefore, saying HTML is not a programming language because it is a markup language, is based on a false statement, and any conclusions you draw from this premise will be absolutely wrong.

"HTML has no logic"

This statement requires us to clarify the meaning of "logic" because the definition may surprise you.

Like Turing Completeness (which we will definitely talk about soon), the person who made this argument seems to misunderstand its exact meaning. I've asked people to tell me what they mean by "logic" and got some interesting answers below:

Logic is a reasonable way of reasoning or thinking.

This is fine if we are looking for a dictionary definition of logic. But we are talking about programming logic, not just logic as a general term. I also received answers like this:

Programming languages ​​include variables, conditions, loops, etc. HTML is not a programming language because you cannot use variables or conditions. It has no logic.

This is good (and certainly better than going to true/false/and/or etc), but it is also wrong. HTML does have variables—in the form of attributes—and these variables/attributes and control structures can be used to determine what is displayed.

But how do you control these variables? You need JavaScript!

Error again. Some HTML elements have internal control logic and do not require JavaScript or CSS to work . I'm not talking about it<link> or Something like that—they are basic control structures that have been part of the standard for decades. I mean those elements that respond to user input and perform conditional operations based on the current state of the element and the value of the variable. by <details>/<summary></summary></details> Tuple or<dialog></dialog> Elements are examples: When the user clicks them, they will be closed if the open attribute exists; if not, they will be open. No JavaScript is required. So simply saying HTML is not a programming language because it lacks logic is misleading. We know that HTML is indeed able to make decisions based on user input. HTML has logic, but it is essentially different from the logic of other languages ​​designed to manipulate data. We need stronger arguments than this to prove that HTML is not a form of programming.

"HTML is not 'Turing-complete'"

OK, this is the argument we see most in this debate. Technically (the best kind of correct), it is correct to say that HTML is not Turing-complete, but this should spark a bigger debate than just using it as an end statement.

I won't go into the meaning of Turing completeness, as there are a lot of resources on this topic. In fact, Lara Schenck sums this up well in one of her articles that argues that CSS is Turing complete:

Simply put, for a language or machine, Turing perfection means that it can do what the Turing machine can do: perform any calculation, that is, general calculation . After all, programming was invented to do math operations, and of course, we are doing more with it now!

Because most modern programming languages ​​are Turing-complete, people use it as the definition of programming languages. But Turing completeness is not the case. It is a standard for identifying whether a system (or its rule set) can simulate a Turing machine. It can be used to classify programming languages; it does not define them. It doesn't even work only in programming languages. For example, the game Minecraft (meets this standard) or the card game Magic (also meets this standard). Both are Turing-complete, but I doubt anyone would classify them as programming languages.

Turing completeness is now popular, just as some people used to think that the difference between compiled and interpreted languages ​​was a good standard. Yes. We don't have to worry about it when developers (mainly backends) underestimate front-end programming (including JavaScript and PHP) is not "real programming". You still hear it sometimes, even though it is now faded, vague, whispered.

The definition of programming (or not) changes over time. I bet someone sorting out piercing cards would complain that typing code in assembly language is not real programming. There is nothing universal or written on stone. There is no actual definition.

Turing completeness is a fair criterion, I must say, but it is biased and subjective – not in its form, but in its way of choosing. Why is one language that can generate Turing complete machines considered a "programming language", while another language that can generate finite state machines does not? This is subjective . This is the same excuse for anyone else to distinguish between "real developers" (those who make this statement) and those who are not as good as them.

To make matters worse, it is obvious that many people who repeat the "HTML is not Turing-complete" spell do not even know or understand what Turing-completeness means. It is not an award or a mark of quality. It is not a badge of honor. It's just a way to classify programming languages ​​- group them instead of defining them. A programming language can be Turing-complete or not, just as it can be interpreted or compiled, imperative or declarative, procedural or object-oriented.

So, is HTML a programming language?

If we can devalue the main arguments that claim HTML is not a programming language, does this really mean that HTML is a programming language? No, that doesn't mean it. Therefore, this debate will continue until HTML standards development or the "current definition" of programming languages ​​changes.

But as developers, we must be wary of this issue because in many cases it is not used to inspire serious debates, but to stir controversy while hiding subterrior motives: from gaining a relaxed internet response to dangerously reducing a group of people’s contribution to the development ecosystem.

Or, as Ashley Kolodziej summed up brilliantly in her ode to HTML:

They say you're not a real programming language like other languages, you're just markup languages, and technically, I guess that's right. Technically, JavaScript and PHP are scripting languages. I still remember that understanding JavaScript wasn't cool at that time, and it wasn't a "real" language either. Sometimes, I find these differences meaningless, like we created a vocabulary to hinder you (and ourselves as developers). You, as a markup language, have your unique value and advantages. Knowing how to best use you is real expertise that often gets overlooked.

Whatever our position on the discussion of "HTML is/is not a programming language", let's celebrate it without denying its importance: HTML is the backbone of the Internet. It is a beautiful language with a lot of documentation and extensive grammar, but it is so simple to learn in an afternoon and so complex that it takes years to master. Whether it is a programming language or not, what really matters is that we have HTML.

The above is the detailed content of HTML is Not a Programming Language?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Adding Box Shadows to WordPress Blocks and Elements Adding Box Shadows to WordPress Blocks and Elements Mar 09, 2025 pm 12:53 PM

Adding Box Shadows to WordPress Blocks and Elements

Create a JavaScript Contact Form With the Smart Forms Framework Create a JavaScript Contact Form With the Smart Forms Framework Mar 07, 2025 am 11:33 AM

Create a JavaScript Contact Form With the Smart Forms Framework

Create an Inline Text Editor With the contentEditable Attribute Create an Inline Text Editor With the contentEditable Attribute Mar 02, 2025 am 09:03 AM

Create an Inline Text Editor With the contentEditable Attribute

Working With GraphQL Caching Working With GraphQL Caching Mar 19, 2025 am 09:36 AM

Working With GraphQL Caching

Making Your First Custom Svelte Transition Making Your First Custom Svelte Transition Mar 15, 2025 am 11:08 AM

Making Your First Custom Svelte Transition

Comparing the 5 Best PHP Form Builders (And 3 Free Scripts) Comparing the 5 Best PHP Form Builders (And 3 Free Scripts) Mar 04, 2025 am 10:22 AM

Comparing the 5 Best PHP Form Builders (And 3 Free Scripts)

File Upload With Multer in Node.js and Express File Upload With Multer in Node.js and Express Mar 02, 2025 am 09:15 AM

File Upload With Multer in Node.js and Express

Best CSS Animations and Effects on CodeCanyon 2025 (Paid   Free) Best CSS Animations and Effects on CodeCanyon 2025 (Paid Free) Mar 01, 2025 am 09:32 AM

Best CSS Animations and Effects on CodeCanyon 2025 (Paid Free)

See all articles