Issue
I have a multi-line search box, and I want everything aligned in the middle. Is it possible to vertically center the content of a <textarea>
?
Solution
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">
<div
style="display: table-cell; vertical-align: middle"
contenteditable="true">
I am vertically aligned
</div>
</div>
Answered By - Daniel Birowsky Popeski
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.