How to vertically center text in textarea?

人盡茶涼 提交于 2019-12-10 14:47:59

问题


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:


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.



来源:https://stackoverflow.com/questions/13552655/how-to-vertically-center-text-in-textarea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!