basics of website design banner photo

HTML

HTML 5

CSS 2.1

CSS 3

Reference





HTML <input> Element

The <input> element enables users to interact with a website by inputting data into an online form.

INPUT TYPES

The type attribute tells the browser what sort of form control to create and the type of input to expect. The types available are:


This is how the input types are displayed on the screen:

photo of input types as seen in a form

<input> Attributes

  • CORE AND LANGUAGE ATTRIBUTES - class, id, title, style, dir, lang
  • MOUSE AND KEYBOARD EVENT ATTRIBUTES - onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmouseout, onmousemove, onkeydown, onkeyup, onkeypress
  • type - what type of input is expected.
  • name - the name given to a specific input element.
  • value - the initial value of this element.
  • src - a URI location for form fields containing an image.
  • alt - alternative text for browsers that dont support images.
  • checked - sets a radio button or checkbox as selected.
  • disabled - sets an input element as unavailable.
  • readonly - cannot be modified by the user.
  • size - sets a size for a form field.
  • maxlength - sets the maximum number of characters that can be entered into this field.
  • usemap - refers to a client-side image map.
  • ismap - refers to a server-side image map.
  • tabindex - gives the position of this element in the tabbing order.
  • accesskey - sets a single key to access this element.
  • onfocus - defines an event that occurs when the element gains focus.
  • onblur - defines an event that occurs when an element loses focus.
  • onselect - sets an event to occur when a user selects some text in a text field.
  • onchange - sets an event to occur when the input element loses focus and it's value has been altered since gaining focus.

The <input> element has been altered considerably in HTML5 with the addition of new input types and attributes. For more details please see the HTML5 input element page.


HTML 4 Element List