The <input type=”text”> specifies a single-line input field designed for textual input.
Example
A form featuring text input fields:
<form> <label for=”fname”>First name:</label><br> <input type=”text” id=”fname” name=”fname”><br> <label for=”lname”>Last name:</label><br> <input type=”text” id=”lname” name=”lname”> </form> |
The <label>
tag links form elements to improve accessibility, aiding screen readers and enabling users to toggle inputs (like radio buttons or checkboxes) by clicking the label text. The for
attribute of <label>
must match the id
of the associated <input>
.