Etiqueta HTML <área de texto>


Ejemplo

Un control de entrada de texto de varias líneas (área de texto):

<label for="w3review">Review of W3Schools:</label>

<textarea id="w3review" name="w3review" rows="4" cols="50">
At w3schools.com you will learn how to make a website. They offer free tutorials in all web development technologies.
</textarea>

Más ejemplos de "Pruébelo usted mismo" a continuación.


Definición y uso

La <textarea>etiqueta define un control de entrada de texto de varias líneas.

El <textarea>elemento se usa a menudo en un formulario, para recopilar las entradas de los usuarios, como comentarios o reseñas.

Un área de texto puede contener una cantidad ilimitada de caracteres y el texto se representa en una fuente de ancho fijo (generalmente Courier).

El tamaño de un área de texto se especifica mediante los atributos <cols>y <rows>(o con CSS).

El nameatributo es necesario para hacer referencia a los datos del formulario después de enviar el formulario (si omite el nameatributo, no se enviará ningún dato del área de texto).

El idatributo es necesario para asociar el área de texto con una etiqueta. 

Sugerencia: ¡ Agregue siempre la etiqueta <label> para conocer las mejores prácticas de accesibilidad!


Compatibilidad con navegador

Element
<textarea> Yes Yes Yes Yes Yes


Atributos

Attribute Value Description
autofocus autofocus Specifies that a text area should automatically get focus when the page loads
cols number Specifies the visible width of a text area
dirname textareaname.dir Specifies that the text direction of the textarea will be submitted
disabled disabled Specifies that a text area should be disabled
form form_id Specifies which form the text area belongs to
maxlength number Specifies the maximum number of characters allowed in the text area
name text Specifies a name for a text area
placeholder text Specifies a short hint that describes the expected value of a text area
readonly readonly Specifies that a text area should be read-only
required required Specifies that a text area is required/must be filled out
rows number Specifies the visible number of lines in a text area
wrap hard
soft
Specifies how the text in a text area is to be wrapped when submitted in a form

Atributos globales

La <textarea>etiqueta también es compatible con los atributos globales en HTML .


Atributos de eventos

La <textarea>etiqueta también es compatible con los atributos de eventos en HTML .


Más ejemplos

Ejemplo

Deshabilitar la opción de cambio de tamaño predeterminado:

<html>
<head>
<style>
textarea {
  resize: none;
}
</style>
</head>
<body>

<label for="w3review">Review of W3Schools:</label>

<textarea id="w3review" name="w3review" rows="4" cols="50">
At w3schools.com you will learn how to make a website. They offer free tutorials in all web development technologies.
</textarea>

</body>
</html>

páginas relacionadas

Referencia HTML DOM: objeto Textarea

Tutorial de CSS: formularios de estilo


Configuración predeterminada de CSS

Ninguna.