Should I size a textarea with CSS width / height or HTML cols / rows attributes?

Pherrymason picture Pherrymason · Oct 9, 2010 · Viewed 562k times · Source

Every time I develop a new form that includes a textarea I have the following dilemma when I need to specify its dimensions:

Use CSS or use the textarea's attributes cols and rows?

What are the pros and cons of each method?

What are the semantics of using these attributes?

How is it usually done?

Answer

kogakure picture kogakure · Oct 9, 2010

I recommend to use both. Rows and cols are required and useful if the client does not support CSS. But as a designer I overwrite them to get exactly the size I wish.

The recommended way to do it is via an external stylesheet e.g.

textarea {
  width: 300px;
  height: 150px;
}
<textarea> </textarea>