Isaac King
Isaac King

Reputation: 358

How do I set the default size of a textarea separately from the minimum size?

There are two ways to set the size of an HTML textarea: the rows and cols attributes in HTML, and the height and width properties in CSS. Unfortunately, these set both the default size of the textarea when the page is first loaded, and also the minimum size that the user can obtain by resizing it on the page. How do I set different sizes for these?

Upvotes: 1

Views: 4241

Answers (1)

leesara
leesara

Reputation: 58

You have to use min-width and min-height for your text area.

<textarea rows="4" cols="10" id="myTextArea">Welcome to StackOverflow</textarea>

In css use:

#myTextArea {
    min-width: 50px;
    min-height: 60px; 
}

Upvotes: 4

Related Questions