Write your first HTML page

Edit a heading, style it with CSS and give a button a small JavaScript action.

What you’ll learn

Connect an HTML page, a CSS file and a JavaScript file.

Before you start

Open the example and find the three file tabs.

Steps

  1. In index.html, replace the text inside <h1> with the name of your class. Keep both tags.
  2. In style.css, change color: navy; inside the h1 rule. Try color: darkgreen; and press Run.
  3. In script.js, change the sentence assigned to greeting.textContent. Run again and press the page’s button.

Expected result

The preview shows your class name and the button reveals your new sentence.

Common mistakes

If the button does nothing, compare its id="hello" with #hello in the script. The # belongs in the selector.