Skip to content
BENIBIX Learn

HTML Input Element

Development🌐 Web DevelopmentBrowser Code

Also known as <input>, Input Tag, Input Field, Form Input

The HTML tag for a box you fill in, like a text box or a tick box.

Think of it like

It is like a blank on a paper form. You write your answer in the box.

Example

Lucy's sign-up form uses type email for the email box. On a phone, the keyboard now shows an @ key, and the browser checks the address.

Why it matters

The right type gives people the right keyboard and free checks. A date type even brings its own calendar.

Definition

The input element is the HTML tag that makes a box or control a visitor can fill in. Its type attribute says what kind it is. There are 22 types, like text, email, password, checkbox, date and range. If you leave the type out, it is a plain text box. An input has no closing tag. Inputs sit inside a form, and each one needs a label so people know what to type.

Example code

html
<label for="email">Email</label>
<input id="email" type="email" name="email" required>
A labelled email box. The browser will not send the form while it is empty.
One element, many types. Each type gives a different box.

Common mistake

Using type text for everything. Then phones show the wrong keyboard, and you must write all the checks yourself.

Key takeaways

  1. 1
    Type decides. The type sets the box and its checks.
  2. 2
    No closing tag. It is one tag, with no end tag.
  3. 3
    Always labelled. A label says what goes in the box.

Learn it properly