HTML Textarea desplazamiento horizontal


Me gustaría proporcionar un desplazamiento horizontal a un área de texto en mi página HTML. El desplazamiento debe aparecer sin envolver, si escribo una línea larga sin un salto de línea. Algunos amigos sugirieron usar el atributo CSS overflow-y, que no funcionó para mí. Los navegadores que uso son IE 6+ y Mozilla 3+.

Author: Shyam, 2009-01-08

4 answers

Para no establecer ningún ajuste, utilizarías:

white-space: nowrap;

Para otros valores: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space

NOTA: Sin embargo, el depreciado wrap="off" parece ser la única forma de soporte para navegadores heredados. Aunque no es compatible con HTML 5, sigue siendo mi preferencia si se dirige a todos los navegadores.

 35
Author: Aram Kocharyan,
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
2015-12-21 19:21:21

Me di cuenta de hacerlo de una manera no compatible con W3c y está funcionando tanto en IE y Firefox y por cierto en Chrome también.

He añadido el atributo wrap con el valor off, es decir <textarea cols=80 rows=12 wrap='off'> es lo que he hecho.

 90
Author: Shyam,
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
2009-01-09 07:21:56

Si tiene texto preformateado que incluye LFs, debe agregar white-space: pre; al css. Eso preservará las nuevas líneas que ya están en el texto y no envolverá líneas largas.

Esto funciona en todas las versiones de Firefox, todos los navegadores basados en Webkit e IE6+.

Fuente: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space

 10
Author: Azdle,
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-01-31 23:14:09

Prueba estos:

overflow: scroll; 
overflow-y: scroll; 
overflow-x: scroll; 
overflow:-moz-scrollbars-vertical;

También debería haber a-moz-scrollbars-horizontal

 4
Author: Filip Ekberg,
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
2009-01-08 13:26:04