🎨 CSS is a styling language that styles elements of an HTML document.
Are They All Coding Languages?
Yes! They are all coding languages—because they are communicative means to dialog with computers effectively.
In other words, when web browsers read an HTML document, they understand that they are to present the page's data as described (annotated) with the HTML markups.
Likewise, when the computer reads a CSS document, it understands that it should style selected HTML elements as stated (declared) with the CSS rulesets.
To understand the differences better, let's see some examples.
Example of an HTML code
The HTML code in the snippet below describes how the computer should display the
Click me! text—that is, as the page's highest-level heading.
Example of a CSS code
The CSS code in the snippet below defines how the computer should style the background of the document's
Observes that both the HTML and CSS code never gave the
Click me! text any command. For example, they did not order, instruct, or make the text do anything like jumping, running, or dancing. Instead, they described and styled the text.
<h1> element gets clicked.
.addEventListener("click", () => alert("Hello there 👋!"));
- Apart from the three languages discussed above, you can use several other computing languages to communicate with computers.
- CSS does not support all units. See the supported ones in this article.