Technically, HTML is a programming language. In fact, HTML stands for Hypertext Markup Language. Whether or not HTML is a real language is a matter of semantics, and not terribly important.
What is important, though, is to understand that HTML – and CSS, for that matter – are quite different than most other languages, and that it’s difficult to get a big picture of what coding is like from those two languages alone.
How are HTML and CSS different than other languages?
HTML and CSS are declarative languages. That is, they are basic statements declaring what should exist on a web page. Here’s some sample HTML:
Basically, the above HTML says that this webpage should contain a section, and the section should contain a header and a paragraph. There isn’t any sort of computation – it’s a simple statement of fact. This is what I refer to HTML as a declarative language.
Similarly, here’s some sample CSS:
The above CSS says that all paragraphs on the webpage should have text that is red, a size of 12 pixels, and should be aligned in the center. Again, there’s no computation – it’s just a series of simple declarations.
HTML and CSS are declarative
While HTML and CSS are declarative, most coding is computational – and it’s what most other coding languages are designed for.
Here’s some computational code that calculates the average of a list of numbers:
This code, instead of making declarations, is performing a series of computations in order to achieve an end result. The first line initializes the list of numbers. The second line calculates the sum of all the numbers in the list. The third line computes the average by dividing the sum by the number of items in the list.
The vast majority of coding languages involve writing computational code. Computational code isn’t always mathematical in nature, but it’s code that creates functionality. While HTML and CSS are declarations about what should appear on a web page, computational code is what makes stuff happen. Adding an item to your shopping cart, shooting a bad guy in a game, deleting an item from your spreadsheet – these are all examples of functionality, and are accomplished through computational code.
The reason why this distinction is important is because many people begin their coding journey with HTML and CSS. And while that’s a fine place to start, it’s important not to jump into a new career based on your experience with those languages alone. It’s premature to assume you enjoy coding and, say, sign up for a coding bootcamp, if you’ve only had experience with HTML and CSS. To truly know whether you’d enjoy coding, you’ll want to have some experience with a classic, computational language, as most programming jobs are primarily about writing computational code.