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

csshtmltextarea

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?

Best Answer

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>