To create a simple form, we use label
, input
and button
label
elements make our forms more accessible. When the user clicks on a label, the associated input field gets focus.
Ex:
<body>
<form>
<!-- Separate by lines -->
<div>
<!-- input `id` should match label `for` -->
<label for="name">Name</label>
<input id="name" type="text" />
</div>
<div>
<label for="email">Email</label>
<!-- set `type` to email for validation -->
<input id="email" type="email" />
</div>
<button type="submit">Register</button>
<button type="reset">Clear</button>
</form>
</body>