Skip to main content

HTML input type="email"

The HTML input type email is an element used in HTML forms to allow users to input and send an email address. It is used to capture the email address of a user and is typically found in contact forms, registration forms, and other forms that require a user to provide an email address.

The input type email is a text field that allows users to enter an email address in a valid format. It is important to note that the input type email does not validate the email address, it only ensures that the user has entered a valid email address format.

<label for="user-email">Email:</label>
<input type="email" id="user-email" name="user-email">

<label for="user-email">Email:</label>
<input type="email" id="user-email" name="user-email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$">
<label for="user-email">Email from example.com:</label>
<input type="email" id="user-email" name="user-email" pattern="[a-z0-9._%+-]+@example\.com$" title="Please enter a valid email address from example.com" required>

Attributes

  • multiple: This attribute allows the user to enter multiple email addresses in a single input field, separated by commas.
  • pattern: This attribute allows you to specify a regular expression that the user's input must match in order to be considered valid. This can be used to validate the format of the email address before it is submitted.