I am displaying the html content in a table. For printing the tags i am using textArea
in the <td>
of the table. So i want to adjust the height and width of textArea
so that it is equal to the <td>
. How can i do this
To set the cell width and height, use the CSS style. The height and width attribute of the <td> cell isn't supported in HTML5. Use the CSS property width and height to set the width and height of the cell respectively. Just keep in mind, the usage of style attribute overrides any style set globally.
height = 'auto'; to this. style. height = '0px'; and add a min-height to prevent the initial state from actually going to 0, scrollHeight will correctly return one row of height when appropriate.
dabblet.demo
this CSS
will help you:
textarea { border: none; width: 100%; -webkit-box-sizing: border-box; /* <=iOS4, <= Android 2.3 */ -moz-box-sizing: border-box; /* FF1+ */ box-sizing: border-box; /* Chrome, IE8, Opera, Safari 5.1*/ }
css
file, you can use inline csslike this:
<textarea style="border: none; width: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box;"> </textarea>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With