textarea's rows, and cols attribute in CSS

ASD picture ASD · Jan 9, 2010 · Viewed 221.7k times · Source

I'd like to set the textarea's rows and cols attributes via CSS.

How would I do this in CSS?

Answer

user2928048 picture user2928048 · Jan 22, 2014
<textarea rows="4" cols="50"></textarea>

It is equivalent to:

textarea {
    height: 4em;
    width: 50em;
}

where 1em is equivalent to the current font size, thus make the text area 50 chars wide. see here.