Forms — input, label, button
Forms collect user input. Each input needs a name and a label.
index.html
v3.1
Live preview
updates as you type
🧠 How it works
form wraps the inputs. action is the URL to submit to, method is GET or POST. label ties text to an input (click the text to focus the input). input types: text, email, password, number, date, checkbox, radio, file, color, range. required — browser won't submit without a value. placeholder — grey hint text. value — default value. textarea — multi-line text input (rows = height in lines). button type='submit' — submits the form. type='button' — just a clickable button.
✏️ Try these changes
-
Change type="email" to type="text"→ no email validation — any text accepted -
Change type="number" to type="range"→ number input becomes a slider -
Add 'disabled' to the password input→ field becomes greyed out and uneditable -
Add <input type="checkbox" name="agree"> I agree→ adds a checkbox -
Wrap the form in <fieldset>...</fieldset>→ form gets a border