Multi Row Tables Always Vertically Center Content

别说谁变了你拦得住时间么 提交于 2019-12-11 12:23:12

问题


I've basically got a table with 2 rows and it looks like this:

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

My problem is that the second row auto centers vertically like this:

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

How so right now I'm adding paragraphs until it just becomes the size of the other:

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

How can I do this correctly using CSS?


回答1:


I think this is what you're looking for:

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

However, if you want all table cells to align their content to the top, you should not define the style inline, but rather add a

td 
{
  vertical-align: top;
}

to your CSS stylesheet.




回答2:


Use Vertical allign: Top



来源:https://stackoverflow.com/questions/2390589/multi-row-tables-always-vertically-center-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!