← HTML Fundamentals
Forms and accessibility · 15 MIN

Input types and validation

Input types and validation

HTML provides email, password, number, date, checkbox, radio and other controls. Attributes such as required, minlength, maxlength, min, max and pattern enable helpful browser-side checks. Client-side validation improves usability but must never replace server-side validation.

Try it yourself

Change the example, run it, and explain the result in your own words. Then create one variation of your own.

Key idea

Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.

Code example

<label for="age">Age</label>
<input id="age" name="age" type="number" min="13" max="120" required>