HTML5 Form Features: New Input Types, required, pattern, min, max, datalist, progress, meter and Built-In Validation

HTML5 and CSS3 55 min min read Updated: Nov 17, 2026 Intermediate
HTML5 Form Features: New Input Types, required, pattern, min, max, datalist, progress, meter and Built-In Validation
Intermediate Topic 3 of 3

New Input Types

TypeGives you
emailChecks for an email shape and shows the email keyboard on phones
urlChecks for a web address
telPhone keypad on phones
numberNumbers only with min, max and step
rangeA slider
date, time, monthA date or time picker
colorA color picker
searchA search box

Validation Attributes

html <form> <label for="name">Name</label> <input id="name" name="name" required minlength="2" maxlength="40"> <label for="email">Email</label> <input id="email" name="email" type="email" required> <label for="age">Age (18 to 65)</label> <input id="age" name="age" type="number" min="18" max="65" step="1"> <label for="zip">PIN code (6 digits)</label> <input id="zip" name="zip" pattern="[0-9]{6}" inputmode="numeric" title="Enter exactly 6 digits"> <button>Send</button> </form>
AttributeRule
requiredThe field cannot be empty
minlength, maxlengthText length limits
min, max, stepNumber and date limits
patternA regular expression the text must match
titleHelps explain the pattern rule

When the form is submitted, the browser blocks it and shows a message on the first field with a problem. No JavaScript is needed.

Server check Browser checks help users but can be bypassed. Always validate again on the server.

Datalist: Suggestions While Typing

html <label for="browser">Favorite browser</label> <input id="browser" name="browser" list="browsers"> <datalist id="browsers"> <option value="Chrome"> <option value="Firefox"> <option value="Safari"> <option value="Edge"> </datalist>

Range, Output, Progress and Meter

html <label for="vol">Volume</label> <input type="range" id="vol" min="0" max="100" value="40"> <label for="task">Upload</label> <progress id="task" value="65" max="100">65%</progress> <label for="disk">Disk used</label> <meter id="disk" min="0" max="100" low="60" high="85" optimum="30" value="72">72%</meter>

progress shows how far a task has gone. meter shows a value inside a known range, such as disk use.

Style Valid and Invalid Fields

css input:user-invalid { border-color: #c62828; } input:user-valid { border-color: #2e7d32; } input:required { border-left: 4px solid #0b5fff; }
Why user-invalid? :invalid also matches empty required fields before the person types anything, which looks harsh. :user-invalid waits until the user interacts. It is newer, so check MDN or Can I Use for support and use :invalid as a fallback.

Practice

  1. Build a signup form with required name, email and a 6 digit PIN code pattern
  2. Add a datalist of cities
  3. Add a progress bar showing 40 percent

Conclusion

HTML5 adds input types and validation attributes that check forms in the browser. Pair them with clear labels and always re-check on the server.

Quick Summary: Input types; validation attributes; datalist; range, progress, meter; validation styling.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators