The The above example demonstrates a number of features of The This element includes the global attributes. This attribute indicates whether the value of the control can be automatically completed by the browser. Possible values are: If the A string which indicates whether or not to activate automatic spelling correction and processing of text substitutions (if any are configured) while the user is editing this Enable automatic spelling correction and text substitutions. Disable automatic spelling correction and text substitutions. autofocus This Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form-associated element in a document can have this attribute specified. cols The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. If it is not specified, the default value is disabled This Boolean attribute indicates that the user cannot interact with the control. If this attribute is not specified, the control inherits its setting from the containing element, for example form The form element that the maxlength The maximum number of characters (UTF-16 code units) that the user can enter. If this value isn't specified, the user can enter an unlimited number of characters. minlength The minimum number of characters (UTF-16 code units) required that the user should enter. name The name of the control. placeholder A hint to the user of what can be entered in the control. Carriage returns or line-feeds within the placeholder text must be treated as line breaks when rendering the hint. Note: Placeholders should only be used to show an example of the type of data that should be entered into a form; they are not a
substitute for a proper readonly This Boolean attribute indicates that the user cannot modify the value of the control. Unlike the required This attribute specifies that the user must fill in a value before submitting a form. rows The number of visible text lines for the control. If it is specified, it must be a positive integer. If it is not specified, the default value is 2. spellcheck Specifies whether the
wrap Indicates how the control wraps text. Possible values are:
If this attribute is not specified, Styling with CSS
Styling HTML forms provides some useful tips on styling Baseline inconsistencyThe HTML specification doesn't define
where the baseline of a Controlling whether a textarea is resizableIn most browsers,
Styling valid and invalid valuesValid and invalid values of a
ExamplesBasic exampleThe following example shows a very simple textarea, with a set numbers of rows and columns and some default content.
Example using "minlength" and "maxlength"This example has a minimum and maximum number of characters — of 10 and 20 respectively. Try it and see.
Note that Example using "placeholder"This example has a placeholder set. Notice how it disappears when you start typing into the box.
Note: Placeholders should only be used to show an example of the type of data that should be entered into a form; they are not a substitute for a proper Disabled and readonlyThis example shows two Note: In browsers other than Firefox, such as chrome, the
Technical summarySpecifications
Browser compatibilityBCD tables only load in the browser See also |