DEV Community

Cover image for HTML vs CSS vs JavaScript: A Useful Comparison of the 3
Oluwatobi Sofela
Oluwatobi Sofela

Posted on • Edited on • Originally published at codesweetly.com

HTML vs CSS vs JavaScript: A Useful Comparison of the 3

The main difference between HTML, CSS, and JavaScript is their functions.

👨‍🏫 HTML is an annotation language that describes a document and its data.

🎨 CSS is a styling language that styles elements of an HTML document.

📢 JavaScript is a commanding language that commands the items of an HTML document.

In other words, HTML is the orator, CSS is the stylist, and JavaScript is the commander.

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.

Also, when devices read a JavaScript document, they understand that they are to command an HTML document as programmed (instructed) with the JavaScript statements.

Example of an HTML code

The HTML code in the snippet below describes how the computer should display the Home Design text — that is, as the page’s highest-level heading.

<h1>Home Design</h1>
Enter fullscreen mode Exit fullscreen mode

Example of a CSS code

The CSS code in the snippet below defines the background color (pink) the computer should style the document’s body.

body {
  background-color: pink;
}
Enter fullscreen mode Exit fullscreen mode

Example of a JavaScript code

The JavaScript code in the snippet below commands the computer to log number 57 onto the browser’s console.

console.log(57)
Enter fullscreen mode Exit fullscreen mode

Note

  • Apart from the three languages discussed above, you can use several other computing languages to communicate with computers.

  • Amongst HTML, CSS, and JavaScript, JavaScript is the only programming language — because it is the only one used to write a series of instructions for computers to execute.

  • CSS does not support all units. See the supported ones in this article.

In summary

HTML, CSS, and JavaScript are all coding languages computers use to present, style, and command a document’s data. They are an essential linguistic system that makes it possible for humans to relate easily to computers. While also making it possible for computers to communicate with one another.

Top comments (0)