How to vertically center text in textarea?

2019-06-22 12:07发布

Is there a way to vertically center text entered in textarea with known width and height? I have a fixed-sized textarea where text should be typed in and I want the text to start from the center while you type it. Horizontal centering could be done with text-align:center, but I cant find any way to align horizontally.

1条回答
干净又极端
2楼-- · 2019-06-22 12:35

I think you cannot do the vertical alignment directly. You should make another div over the text area and use it to make text vertically aligned and take the inputs from user to the textarea and transfer it to the div using the JS.

And make the textarea invisible only.

查看更多
登录 后发表回答