what is considered best practice when specifying the dimensions of an HTML textarea? only using cols/rows (which i think are mandatory with html strict 4.01) or specifying width and height using css properties? or even setting cols/rows for validity and then overriding the actual size using css?
The size of a text area is specified by the cols and rows attributes (or with CSS).
The cols attribute specifies the visible width of a text area. Tip: The size of a text area can also be set by the CSS height and width properties.
Try textarea {max-width:95%;} - it will always fit your display. Show activity on this post. I set the number of columns to slightly greater that the width of the div on a large screen and as the screen gets smaller it acts responsive to the screen size.
There are two ways of setting the size of the HTML <textarea> element. You can use HTML or CSS. In HTML, you can use the cols and rows attributes.
Please see this question: Should I size a textarea with CSS width / height or HTML cols / rows attributes?
I agree with the top answer. You use rows/cols in case CSS is not supported; if width or height are specified using CSS, they override the value derived from rows/cols.
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