How to create a single-line text input in HTML

The 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

Comments

Leave a comment

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