html - CSS,垂直对齐表格单元格中的 anchor

标签 html css html-table alignment

我需要将表格单元格中的 anchor 标记对齐到顶部,表格单元格包含一个文本区域。我的代码如下,但 anchor 标记与文本区域的底部对齐。

<style>
td {
  border:#777 1px solid; vertical-align:top;
}

textarea {
  height:100px; width:300px;
}
</style>

<table>
  <tr>
    <td>Message:</td>
    <td>
      <textarea></textarea>
      <a href="javascript:" title="Required">*</a>
    </td>
  </tr>
</table>

如何将该 anchor 标记垂直对齐到单元格顶部?

enter image description here

最佳答案

也为 anchor 顶部垂直对齐:

td a {
    vertical-align: top;
}

关于html - CSS,垂直对齐表格单元格中的 anchor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19332159/

相关文章:

html - 让我的列表项中包含的每个 DIV 在列表项悬停时准确地居中于 1024px 宽

javascript - 给出输入后更改图像

html - 使用 Bootstrap 强制图像缩放

javascript - 使用 jquery 和 css 在点击时展开 div

javascript - element.style.display = 'none' 在 firefox 中不起作用,但在 chrome 中有效

php - 通过 PHP + HTML 从 MySQL 数据库中选择数据创建表

html - 我的元素没有填满页面的整个空间

html - 在表格交叉线上方的中心页面设置响应图像

html - TD 高地和探险家

html - 如何重复背景图像的一部分