1

我基本上有一个有 2 行的表,它看起来像这样:

---------
|   |   |
|   |   |
|   |   |
|--------

我的问题是第二行自动垂直居中,如下所示:

|hey|   |
|hey|hey|
|hey|   |
|--------

我现在如何添加段落,直到它变成另一个的大小:

|hey|hey|
|hey|   |
|hey|   |
|--------

如何使用 CSS 正确执行此操作?

4

2 回答 2

4

我想这就是你要找的:

<table>
  <tr>
    <td>Some content<br />More content<br />More content</td>
    <td style="vertical-align: top;">Some different content</td>
  </tr>
</table>

但是,如果您希望所有表格单元格的内容与顶部对齐,则不应定义内联样式,而应添加

td 
{
  vertical-align: top;
}

到您的 CSS 样式表。

于 2010-03-05T23:40:18.920 回答
-1

使用垂直对齐:顶部

于 2010-03-05T23:11:24.853 回答