How to Write HTML
Every HTML element is written the same way — an opening tag, the content inside it, and a closing tag.
<h1>
↑
opening tag
My Magical 8 Ball
↑
content
</h1>
↑
closing tag
Sometimes elements contain other elements. Our ball is a <button> with a <p> nested inside it for the answer text.
<button>
<p>8</p>
</button>
Common HTML Tags
| Tag | What It Creates | Example |
|---|---|---|
<h1> |
A large heading | <h1>My Magical 8 Ball</h1> |
<p> |
A paragraph of text | <p>Ask a question</p> |
<div> |
A generic container for grouping other elements together | <div>...</div> |
<button> |
A clickable button — this is our ball | <button type="button">...</button> |
Explore more tags here — w3schools.com.
Start building your game
This is the HTML for our Magic 8 Ball. Open the Preview tab to see what plain HTML looks like before any styling is added. Add everything in green — check all three tabs.
🔒
Ask Arissa for the password after you tried yourself.