HTML Forms & Form Elements
[Classroom Tip] This demo lets you interact with every major HTML input type, see label accessibility in action, explore fieldset/legend grouping, and watch HTML5 validation fire — all without any backend server.
All these are just <input> with different type attributes.
<input type="radio" name="level" id="r1" value="beginner"> <label for="r1">Beginner</label> <input type="radio" name="level" id="r2" value="advanced"> <label for="r2">Advanced</label>
All share the same name — selecting one deselects others.
<input type="checkbox" name="topics[]" id="c1" value="html"> <label for="c1">HTML</label> <input type="checkbox" name="topics[]" id="c2" value="css"> <label for="c2">CSS</label>
Each checkbox is independent — multiple can be checked simultaneously.
Always associate a <label> with its input. Click the label text to see the difference.
Uses <span> instead of <label for="..."> — screen readers can't associate them.
Click the "Username:" label — focus jumps to the input. Works for click targets and screen readers.
<fieldset> <legend>Personal Info</legend> <label for="fname">First Name</label> <input id="fname" type="text" /> <label for="lname">Last Name</label> <input id="lname" type="text" /> </fieldset> <fieldset> <legend>Course Preferences</legend> ...checkboxes... </fieldset>
Fill in the fields and click Submit. Browser validation fires without any JavaScript.
<form method="GET" action="/search"> <input type="text" name="q"> </form>
/search?q=html<form method="POST" action="/login"> <input type="password" name="pass"> </form>