HTML5 Editor with Live Examples
Pick an HTML5 feature, see a working example and change the code to learn how it behaves. Ten examples cover dialogs, collapsible sections, built-in form validation, new input types, canvas, templates and more, each with a live preview.
Try HTML5 features live
Choose an example, then edit the code. The preview updates as you type, and anything the example logs appears under it.
Examples run in a sandboxed frame in your browser. Some controls, such as the date picker and color picker, look different in each browser because the browser draws them. All ten examples work in current versions of Chrome, Edge, Firefox and Safari.
What HTML5 gives you without JavaScript libraries
Many interface pieces that once needed a plugin or a library are now built into the browser.
A native element does more than look right. The dialog element keeps keyboard focus inside the open dialog and closes with Esc. A details element opens and closes with Enter or Space. A required email field refuses an address without an @ and tells the visitor why. Recreating that behavior by hand takes a surprising amount of JavaScript, and is easy to get subtly wrong.
The examples use only HTML, CSS and a few lines of plain JavaScript where the feature calls for it, such as opening a dialog or drawing on a canvas. Change a value, delete an attribute or add your own element, and the preview shows the effect within a moment. Messages written with console.log appear under the preview, so you can see what a script did.
Semantic elements such as header, nav, main, article and footer belong here too. They do not change how a page looks, but they describe its structure to search engines and give screen-reader users landmarks to jump between, which is why the semantic example matters as much as the interactive ones.
Accessible by default
Keyboard handling and screen-reader roles come with the element.
Less JavaScript
Validation, dialogs and disclosure widgets need little or no script.
Edit and learn
Change any example and the preview responds as you type.
How to learn from an example
Reading code teaches less than changing it. Use each example as a starting point.
Run it as it is
See what the example does and try every control before changing anything.
Change one thing
Edit a single attribute or value, such as min on a number field, and watch the result.
Break it on purpose
Remove an attribute such as required or method="dialog" to see which part does the work.
Take it with you
Select Open in HTML Runner to keep editing, share a link or download the code.
The HTML5 features guide on the blog explains each feature in more depth, with notes on when to use it.
Why <dialog> beats a hand-made popup
A modal built from divs needs code for focus, Esc and the background. The dialog element brings all three.
Opening a dialog with showModal() puts it above the rest of the page, makes the page behind it inert, moves keyboard focus into the dialog and closes it when the visitor presses Esc. The ::backdrop pseudo-element styles the dimmed layer behind it with ordinary CSS.
A form inside the dialog with method="dialog" closes it when a button is pressed and records that button's value in returnValue, so you can tell which choice was made without any extra event handlers.
<dialog id="note">
<p>Saved!</p>
<form method="dialog"><button>OK</button></form>
</dialog>
<style>
dialog { border: 0; border-radius: 12px; padding: 24px; }
dialog::backdrop { background: rgb(0 0 0 / 0.5); }
</style>
<script>
document.getElementById("note").showModal();
</script>Try it, read about it, check it
Three places on HCODX help you use HTML5 well.
This editor
Ten live examples you can change, with a preview and console output.
HTML5 features guide
An article on semantic elements, media, forms, data attributes and responsive images.
HTML validator
Find unclosed elements, missing labels and other mistakes in your own pages.
HTML5 editor questions
Use HTML5 in a real project
Build pages with these elements in the HCODX editor, with a file tree, live preview and ZIP export.
Instant HTML Runner & Viewer with Live Preview
Need to run a short HTML, CSS and JavaScript snippet? The HTML Runner Online has a focused editing surface with live output.
Open HTML Runner Online