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!

A fascinating new site called The Markup just launched. Tagline: Big Tech Is Watching You. We’re Watching Big Tech. Great work from Upstatement. The

I posted about parsing an RSS feed in JavaScript the other day. I also posted about my RSS setup talking about how Feedbin is at the heart of it.

Learn how to create a custom CodePen block with a preview for Sanity Studio, inspired by Chris Coyier’s implementation for Wordpress’ Gutenberg editor.

Line, bar, and pie charts are the bread and butter of dashboards and are the basic components of any data visualization toolkit. Sure, you can use SVG

We are always looking to make the web more accessible. Color contrast is just math, so Sass can help cover edge cases that designers might have missed.

Tartan is a patterned cloth that’s typically associated with Scotland, particularly their fashionable kilts. On tartanify.com, we gathered over 5,000 tartan

Not long ago, I posted about PHP templating in just PHP (which is basically HEREDOC syntax). I'm literally using that technique for some super basic

Have you ever clicked on an image on a webpage that opens up a larger version of the image with navigation to view other photos?


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version
Chinese version, very easy to use

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.