html - 如何对齐html中的两个文本区域

标签 html css

如何在 html 中对齐两个文本区域。 我正在尝试下面的代码

<div text-align:right>
<label for="source" style="margin-right: 90px;margin-top: 500px;">Source Address: </label>
<textarea id="source" style="vertical-align:middle;"></textarea><br><br>
<label for="source" style="margin-right: 90px;margin-top: 500px;">Destination Address: </label>
<textarea id="Destination" style="vertical-align:middle;"></textarea>
</div>

enter image description here

最佳答案

试试这个。我在 label 标签中添加了这个 css display: inline-block;宽度:28%; margin-right: 1%;.

<div text-align:right>
  <label for="source" style="display: inline-block; width: 28%; margin-right: 1%;">Source Address: </label>
  <textarea id="source" style="vertical-align:middle;"></textarea><br><br>
  <label for="source" style="display: inline-block; width: 28%; margin-right: 1%;">Destination Address: </label>
  <textarea id="Destination" style="vertical-align:middle;"></textarea>
</div>

关于html - 如何对齐html中的两个文本区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47193481/

相关文章:

html - 在新的 div 中打开的缩略图(不是灯箱)

javascript - 在不同的 .js 文件中使用 .js 文件中的函数

javascript - 外部JS文件按钮调用

javascript - 在固定位置 Div 中垂直居中图像

javascript - Testcafe Selector.exists 不返回 bool 值

html - 出现在错误列中的部分和文本之间的间隙

jquery - HTML 5 文件加载图像作为背景图像

css - 移动 View 中右侧大屏幕中的空白区域

css - 在 Django 中覆盖 Bootstrap 时出现异常

html - 如何在IE中制作滚动面板