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?
Solution 1:
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;
}