<input> element

The input element is used to collect user input. The default input element is a text field:

      <form method="post" action="http://yourServer/form">
                  <label for="fave">Item: 
                     <input autofocus id="fave" name="fave" />
                  <label for="name">Name: <input disabled id="name" name="name" /></label>
            <button>Submit Vote</button>
Click to view this demo.

Using the input Element for Text Input

There are additional attributes for the text type input.

AttributeDescriptionNew in HTML5
dirnamedirectionality of the text.No
listSets the id of a datalist element that provides values for this element.Yes
maxlengththe maximum number of characters that user can enter.No
patternSpecifies a regular expression for input validation.Yes
placeholderSpecifies a hint to the userYes
readonlyMakes the text box read-onlyNo
requiredSpecifies that the user must enter a valueYes
sizeSpecifies the width of the element in the number of characters.No
valueSpecifies the initial valueNo
  HTML CSS Book 

  1. <input> element
  2. input element max size
  3. input text field size
  4. input text field initial value
  5. input text field placeholders(gray text)
  6. Using a Data List
  7. Read-Only input text field
  8. Disabled Text Boxes
  9. input element for password input
  10. Using the input Element to Create Buttons