HTML, CSS and JavaScript — What Each One Does

The three languages of the web explained with one small example you can try in any browser.

htmlcssjavascriptbeginner web development

Every web page is built from three languages. Think of a house:

  • HTML is the walls and rooms.
  • CSS is the paint and furniture.
  • JavaScript is the electricity — things that react when you use them.

Try it yourself

Make a file called page.html, paste this in, and open it in your browser:

<!doctype html>
<h1 id="title">Hello!</h1>
<button id="btn">Click me</button>
<style>
  h1 { color: teal; font-family: sans-serif; }
</style>
<script>
  document.getElementById('btn').onclick = () => {
    document.getElementById('title').textContent = 'You clicked!';
  };
</script>
  • The <h1> and <button> are HTML.
  • The color: teal is CSS.
  • The click that changes the text is JavaScript.

What to learn next

  1. HTML: headings, links, images, forms.
  2. CSS: flexbox and grid for layout.
  3. JavaScript: variables, functions and events.

Read how a website works to see how these files reach the browser.

← All learn