<html>
<body>
This should be level with the middle of the box!
<textarea id="id" name="name" rows="9" cols="50">Text is in here!</textarea>
</body>
</html>
Picture of what this ends up looking like .
如何使框左侧的文本与框的中间保持水平,即使它被拖来拖去?可以用 CSS 完成吗,还是需要 Javascript?
最佳答案
最简单的方法(如果您想避免使用表格)是 float 标签并将其行高设置为文本区域高度:
关于html - 如何使文本与文本区域的中间对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12133492/