Is HTML a programming language?

HTML Code

The short answer: Probably not

HTML (Hyper Text Mark-up Language) is not a programming language, as the name suggests, it is a mark-up language (as explained below). Simply put, HTML is a code that describes how a particular web page looks like. HTML can also contain the formatting of its elements, like font size, color, style, background color, location, and many more. But in modern web development we put that styling code into a separate file, which is called CSS (Cascaded Style Sheet). So, while HTML defines the structure of the page, CSS gives it a style. But you cannot instruct computer to execute procedures with them, for example you can not define loops, make branching with if/else, declare functions, handle events and many more.

What is mark-up?

Imagine, that on you website you want “Welcome to my website” text and want it to be size 18 and color red. Now, how can we tell computer to store that formatting data? We can do that with a mark-up language using so-called tags (special symbols). Like

<p style=”font-size:18px color:red”>Welcome to my website</p>.

In above example we tell computer that “Welcome to my website” is a paragraph, because it is surrounded with <p></p> tags (HTML part). By adding style=”font-size:18px color:red” code, we also tell computer the style of that paragraph (CSS part). Simple, isn’t it? When our HTML/CSS codes grow bigger, then it is much practical to keep that style information in a separate file called CSS (Cascaded Style Sheet).

So, HTML code defines the structure, i.e. tells that here will be a paragraph with a particular text inside:

<p>Welcome to my website</p>

And CSS code tells how that a paragraph should be formatted:

p{
font-size: 18px;
color: red;
}

Browsers like Chrome, Safari, Firefox, Edge, etc. know that any text wrapped into <p></p> tag should be of size 18 pixels and painted in red color, and displays that text in that particular way for the user. That is it!

So, what are the programming languages then?

Simply put, we are dealing with a programming language, when we can define variables, store and read values with them, write functions, write loops, if statements, handle events like button clicks and many many more. As HTML/CSS can not do any of those described, we make our websites alive by adding JavaScript (JS) code. JS is a scripting language (program that serves for a particular purpose), which was initially used for only front-end development (that is what you see and can interact with right now on this website). On the back-end side (all that happens in the server and you as a user cannot see that) we use programming languages, with (the respective frameworks shown in parenthesis) like Java (Spring), C# (ASP.NET), PHP (Laravel), Python (Flask, Django), Ruby (Rails) and now also JavaScript with its relatively new framework Node.JS (simply speaking, JavaScript language implementation for back-end).

Watch my brief visual expiation of the difference between HTML, CSS and JS.

The link to my online course: https://online.datorium.eu

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on telegram
Share on vk
Share on reddit
Share on pinterest
Share on google
Share on email

More To Explore