The size of a textarea can be specified by the cols and rows attributes, or even better; through CSS' height and width properties. The cols attribute is supported in all major browsers.
textarea { border:1px solid #999999; width:100%; margin:5px 0; padding:3px; box-sizing: content-box; } box-sizing: content-box; means that the width of the actual element is equal to the width of the element's content box. so when you add padding (in this case padding-right and padding-left --> because we are talking about width) and border (in this case border-right and border-left ...
I'm trying to do a simple auto-expanding textarea. This is my code: textarea.onkeyup = function () { textarea.style.height = textarea.clientHeight + 'px'; } But the textarea just keeps growing
113 Well, everything between <textarea> and </textarea> is used as the default value for your textarea box. There is some whitespace in your example there. Try to eliminate all of that. Make sure that the following is the case: