How to create a single-line text input in HTML


<label for="username">Username</label>
<input type="text" id="username" maxlength="15">

We've created a <label> so that the user knows what to type in the input box. The for attribute on the label corresponds to the ID on the <input> box.

The result

input box on web page

Next: How to create a single-line password input in HTML


Leave a comment

What color are green eyes? (spam prevention)
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.