Using an HTML Playground Effectively
Workflow tips for prototyping and teaching with a playground—without treating it like a full IDE.
Steps
- Load an example close to your goal.
- Edit one concern at a time.
- Use Auto Run while tweaking CSS.
- Switch preview widths for responsive checks.
- Download index.html when the prototype is useful.
Example
HTML
<button id="counter">0</button>
CSS
#counter { font-size: 2rem; padding: 16px; }
JavaScript
let count = 0;
document.getElementById("counter").addEventListener("click", (event) => {
event.currentTarget.textContent = ++count;
});
Run this counter and click the button: its number increases by one each time. Change the font size to test CSS separately from behavior. Rerunning the preview resets JavaScript state. Local storage saves source code, not the running counter value. This playground does not install npm packages or run a backend.
Tip
Playgrounds shine for teaching and spikes; move to a local repo when you need packages and tests.