HTML 4 input Tag

Also see HTML5 <input> Tag.

This page contains information about the HTML 4 version of this element. For a more up to date version, see HTML5 <input> Tag.

The HTML input tag is used within a form to declare an input element - a control that allows the user to input data.

Using the input tag, you can add controls such as text input, radio buttons, checkbox controls, submit buttons, and more.

The HTML 5 version of this tag introduces some new attributes.


First name:
Last name:


Attributes specific to this tag:
typeSpecifies the type of control. Possible values:
  • text
  • password
  • checkbox
  • radio
  • submit
  • reset
  • file
  • hidden
  • image
  • button
nameAssigns a name to the input control.
valueSpecifies the intial value for the control. Note: If type="checkbox" or type="radio" this attribute is required.
sizeSpecifies the width of the control. If type="text" or type="password" this refers to the width in characters. Otherwise it's in pixels.
maxlengthSpecifies the maximum number of characters that the user can input. This can be bigger than the value indicated in the size attribute.
checkedIf type="radio" or type="checkbox" it will already be selected when the page loads.
srcIf type="image", this attribute specifies the location of the image.
Other Attributes:
classDocument wide identifier.
idDocument wide identifier
dirSpecifies the direction of the text
langLanguage code
titleSpecifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip").
styleInline style (CSS)
alignFor alignment (left, center, right, justify).
altAlternate text. This specifies text to be used in case the browser/user agent can't render the input control.
acceptSpecifies a comma-separated list of content types that the server accepts.
readonlySets the input control to read-only - it won't allow the user to change the value. The control however, can receive focus and are included when tabbing through the form controls.
disabledDisables the input control. The button won't accept changes from the user. It also cannot receive focus and will be skipped when tabbing.
tabindexHelps determine the tabbing order (when the user 'tabs' through the elements on the page).
accesskeyAccess keys (or shortcut keys)
ismapFor image maps. See HTML map tag
usemapFor image maps. See HTML map tag
onfocusIntrinsic event (see event handlers)
onblurIntrinsic event (see event handlers)
onselectIntrinsic event (see event handlers)
onchangeIntrinsic event (see event handlers)
onclickIntrinsic event (see event handlers)
ondbclickIntrinsic event (see event handlers)
onmousedownIntrinsic event (see event handlers)
onmouseupIntrinsic event (see event handlers)
onmouseoverIntrinsic event (see event handlers)
onmousemoveIntrinsic event (see event handlers)
onmouseoutIntrinsic event (see event handlers)
onkeypressIntrinsic event (see event handlers)
onkeydownIntrinsic event (see event handlers)
onkeyupIntrinsic event (see event handlers)

HTML5 Tags

The information on this page is based on HTML version 4.01. Most modern browsers now support HTML5, which is the next version of HTML after HTML 4.01.

See HTML5 <input> Tag for the HTML5 version of the above element.

Also see this list of HTML 5 tags for the latest version of HTML.