HTML Form Examples
A runnable gallery of everyday form controls — text, email, password, checkbox, radio, select, textarea, submit and required validation — each a short editable demo you can render.
Overview
A gallery of runnable form controls — edit any one live in the editor. New to forms? Start with HTML Forms — the basics.
Examples
Text input
Email input
Password input
Checkbox input
Radio buttons
Select dropdown
Textarea for long text
Submit button
Required field validation
Frequently asked questions
How do I link a label to an input?
Set the input's
id and the label's for to the same value, or wrap the input inside the <label>. See how to create a form for the full build.How do I make a form field required?
Add the
required attribute to the control. The browser blocks submission while it is empty and shows a built-in message, with no JavaScript.When should I use a select instead of radio buttons?
Use radio buttons for a short list the user should see at a glance (two to four options); use a
<select> dropdown when the list is long and saving vertical space matters.