I'm not sure why it doesn't work in Chrome, but you can just override the style in the textarea cell like this:
JSFiddle: http://jsfiddle.net/PyPhk/2/
HTML:
<table style="width: 100%; border: 2px solid black;"> <tr> <td style="width: 40%; height: 20px;"> ABC </td> <td style="width: 20%; height: 20px;" class="textCell"> <textarea style="width: 100%;"></textarea> </td> <td style="width: 40%; height: 20px;"> DEF </td> </tr> </table>
CSS
table tr td { white-space: nowrap; } .textCell { white-space: normal; }
UPDATE:
After checking the original scripts, you can see that Chrome provides a default style in its own stylesheet: user agent stylesheet
The included styles for the text box include:
textarea { margin: 0em; font: -webkit-small-control; color: initial; letter-spacing: normal; word-spacing: normal; text-transform: none; text-indent: 0px; text-shadow: none; display: inline-block; text-align: start; }
A style that impedes your desired behavior is display: inline-block . The difference is that other browsers (Firefox) do not define this default style.
Thus, a valid fix overrides this, as @prisoner suggests, although you assume it has flaws.
textarea{ display: block; }
You can either stick to my work, which redefines the style at the table cell level, or you can define a class specifically for this text field using display: block; applied to it, so the "flaws" that you think of do not apply to all text areas.
source share