开发者

HTML align table rows on top

I have an HTML table. It looks as follows:

<table>
    <tr>
        <td>Content one</td>
        <td rowspan="2"> Very long content right</td>
    </tr>
    <tr>
        <td>Content two</td>
    </tr>
</table>

As you see, I have some very long content on the right side of th开发者_Go百科e table, actually, it is so long that it does not fit into what height is given by the table rows, and so the table gets higher, and by doing that, the contents one and two are no longer at the top of the table, but distribute themselves along the whole height. How can I stop them from doing this?

EDIT: What I need is not the content to be aligned at the top, but the actual rows themselves.


Interestingly, noone gave the correct answer yet, so I'm jumping in to close this question in a satisfactory way.

What you really need is the valign='baseline' CSS property to align the first text lines of the <td> elements.

td {
  vertical-align: baseline;
}


if you want to TD to be aligned at the top you need to set the vertical-align of the TR in the CSS not the TD


<td valign='top' >


May be you use the div for internal scroll option without disturbing the page height.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜