Birowsky Birowsky - 1 year ago 120
CSS Question

Middle (vertically) align text inside a <textarea>

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

Answer Source

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 <table> and <tr> and <td> to your markup, you would like something regular like a <div>, you would still need two of them:

<div style="display: table">
    style="display: table-cell; vertical-align: middle"
    I am vertically aligned
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download