Arteqo Consulting

The European Web Agency

Design, brand and digital development


×

Arteqo Consulting Services

Contact Arteqo

×
I have read and accept the terms and conditions

input tag

The input tag, which, when implemented in the code, is written like this - <input>, is an HTML tag that belongs to forms and input tags. Form and Input HTML tags are used to create interactive website elements, hence the name of the category. It includes object such as HTML drop-downs, buttons etc.

<input> creates an input field inside a form defined by the <form> tag. This tag is supported in the current version of HTML, which is HTML5.

Browser support

Here you can see whether <input> is supported by a certain browser, and, if yes, starting from which version it is supported.

Browser support for <input>
ChromeFirefoxEdgeOperaSafari
Is supportedIs supportedIs supportedIs supportedIs supported

Attributes and values

An attribute is a piece of additional information about a tag. While tags denote the type of objects they mark or create, attributes set the parameters of these objects. These parameters can include anything from the types of possible interactions to its visual style to its actual contents.

Values indicate how a certain attribute is actually implemented, if there is a number of ways it can happen.

What attributes are actually allowed in a certain tag depends on the tag itself. Much like possible attributes depend on a tag, possible values depend on an attribute.

The <input> tag supports the following attributes (with their respective values):

AttributeValueDescription
align
  • left
  • right
  • top
  • middle
  • bottom
Specifies the alignment of an image input (only for type="image")
(Not Supported in HTML5)
accept
  • file_extension
  • audio/*
  • video/*
  • image/*
  • media_type
Specifies the types of files that the server accepts (only for type="file")
alttextSpecifies an alternate text for images (only for type="image")
autocomplete
  • on
  • off
Specifies whether an <input> element should have autocomplete enabled
autofocusautofocusSpecifies that an <input> element should automatically get focus when the page loads
checkedcheckedSpecifies that an <input> element should be pre-selected when the page loads (for type="checkbox" or type="radio")
dirnameinputname.dirSpecifies that the text direction will be submitted
disableddisabledSpecifies that an <input> element should be disabled
formform_idSpecifies one or more forms the <input> element belongs to
URLURLSpecifies the URL of the file that will process the input control when the form is submitted (for type="submit" and type="image")
  • application/x-www-form-urlencoded
  • multipart/form-data
  • text/plain
  • application/x-www-form-urlencoded
  • multipart/form-data
  • text/plain
Specifies how the form-data should be encoded when submitting it to the server (for type="submit" and type="image")
  • get
  • post
  • get
  • post
Defines the HTTP method for sending data to the action URL (for type="submit" and type="image")
formnovalidateformnovalidateDefines that form elements should not be validated when submitted
heightpixelsSpecifies the height of an <input> element (only for type="image")
listdatalist_idRefers to a <datalist> element that contains pre-defined options for an <input> element
max
  • number
  • date
Specifies the maximum value for an <input> element
maxlengthnumberSpecifies the maximum number of characters allowed in an <input> element
min
  • number
  • date
Specifies a minimum value for an <input> element
multiplemultipleSpecifies that a user can enter more than one value in an <input> element
widthpixelsSpecifies the width of an <input> element (only for type=image)
type
  • button
  • checkbox
  • color
  • date
  • datetime-local
  • email
  • file
  • hidden
  • image
  • month
  • number
  • password
  • radio
  • range
  • reset
  • search
  • submit
  • tel
  • text
  • time
  • url
  • week
Specifies the type <input> element to display
readonlyreadonlySpecifies that an input field is read-only
stepnumberSpecifies the legal number intervals for an input field
placeholdertextSpecifies a short hint that describes the expected value of an <input> element
patternregexpSpecifies a regular expression that an <input> element’s value is checked against
valuetextSpecifies the value of an <input> element

Global Attributes

Global attributes are HTML tag attributes that can be used by any tag, hence the name "global". They are in contrast to unique attributes that are tag-specific.

<input> supports global attributes.

Event Attributes

Event attributes are HTML tag attributes that allow triggering actions upon specific conditions, hence the name "event". Other types of attributes, namely global and unique attributes, can also trigger actions, but the difference is that even attributes allow calling scripts, such as JavaScript functions, while most other attributes only support a certain type of action.

<input> supports event attributes.