Search code examples
htmlcsstextarea

How to change textarea font size without affecting the width


How do I change the font size of the textarea without affecting the width of the textarea box?

I know by applying css such as:

textarea {
    font-size:16px;
}

However it affects the textarea size.


Solution

  • Code in your width and height in the css.

    textarea {
        width: 500px;
        height: 300px;
    }
    

    You can also do this in the html by using the rows, and cols attributes:

    <textarea rows="4" cols="50"></textarea>