Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use cols/rows or style-width/height to specify dimensions of textarea? [duplicate]

Tags:

html

css

textarea

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?

like image 962
knittl Avatar asked Feb 20 '11 10:02

knittl


People also ask

What attribute can specify the width and height of a textarea?

The size of a text area is specified by the cols and rows attributes (or with CSS).

How do I change the width and height of a textarea in HTML?

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.

How make textarea responsive CSS?

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.

How do I reduce the size of the text area in HTML?

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.


1 Answers

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.

like image 185
MaxVT Avatar answered Oct 11 '22 02:10

MaxVT