Middle (vertically) align text inside a <textarea>

前端 未结 4 1328
不知归路
不知归路 2021-01-07 19:31

It\'s a multiline search-box, so i want everything aligned in the middle. Is it possible?

4条回答
  •  星月不相逢
    2021-01-07 20:02

    Back in the days when i was asking this, i tried achieving this with textarea which is really not possible without scripting. The answer was adding HTML5's contenteditable="true" on a table cell with style="vertical-align: middle". If one's project allows modern HTML, this is a rather simple and effective solution.

    If instead of adding

    and and
    to your markup, you would like something regular like a
    , you would still need two of them:

    I am vertically aligned

    提交回复
    热议问题