HTML <input> tag
- closing tag
- none — void element
- void element
- yes
- lives inside
- <form>
- typically holds
- n/a (self-contained)
Where it goes
Inside a <form>, usually next to a <label>.
Example
<label for="email">Email</label>
<input type="email" id="email" name="email">Open this example in the editor →
Common mistakes
- Writing </input>. There is nothing to close.
- Leaving off type. You get a plain text box, which may not be what you meant.
- Skipping the <label>. The field is much harder to use with a screen reader (software that reads the page aloud). It is also harder for anyone clicking to focus it.
- Forgetting name. The visitor can type, but the value is never sent, because there is nothing to attach it to.