Cómo deshabilitar el cambio de tamaño de textarea?


Necesito deshabilitar el redimensionamiento horizontal de textarea. A veces quiero permitir el cambio de tamaño vertical en el área de texto.

Cada vez que creo una página de contacto, el área de texto hace que mi diseño sea feo.

¿Podría alguien darme una solución para desactivarlo, por favor?

 132
Author: Jon Kyte, 2012-02-21

5 answers

Puedes usar css

Desactivar todo

textarea { resize: none; }

Solo redimensionamiento vertical

textarea { resize: vertical; }

Solo redimensionamiento horizontal

textarea { resize: horizontal; } 

Desactivar vertical y horizontal con límite

textarea { resize: horizontal; max-width: 400px; min-width: 200px; }

Desactivar horizontal y vertical con límite

textarea { resize: vertical; max-height: 300px; min-height: 200px; }

Creo que min-height debería ser útil para usted

 250
Author: Muhammed,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-11-22 14:12:02

Con algunos css como este

textarea
{
   resize: none;
}

O si solo quieres vertical

textarea { resize:vertical; }

U horizontal

textarea { resize:horizontal; } 

O ambos (no es su caso)

textarea { resize:both; } 
 36
Author: Marc,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-02-21 17:34:31

Puede poner esto en el archivo CSS:

textarea {
  resize: none;
} 
 11
Author: Stelian Matei,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-02-21 17:33:41

Desactivar horizontal y vertical con límite

textarea { 
    width:100%;
    resize:vertical; 
    max-height:250px; 
    min-height:100px; 
}
 5
Author: NoOneCare,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-03 06:40:26

Para textarea usé width: 500px !important y height: 350px !important, por lo que estos códigos CSS evitan el cambio de tamaño del usuario, pero si tiene otras etiquetas debe usar resize: none, para explicaciones completas lea Este Enlace.

Por ejemplo, para una etiqueta p debe establecer la propiedad overflow con un valor que no sea visible y luego establecer resize, none, both, vertical, horizontal.

 0
Author: AngelHotxxx,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-04 11:43:25