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
- In
index.html, replace the text inside<h1>with the name of your class. Keep both tags. - In
style.css, changecolor: navy;inside theh1rule. Trycolor: darkgreen;and press Run. - In
script.js, change the sentence assigned togreeting.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.