垂直对齐和分配表中的行

时间:2017-02-24 23:47:17

标签: html css internet-explorer-11 vertical-alignment

第二列跨越2行。我希望每行不要将第一列除以50%。 Row2应该从Row1的内容开始。

<table border="1" style="width:850px">
    <tr>
        <td style="width: 50%; vertical-align: top;">1.Row Cell 1</td>
        <td rowspan="2" style="height:800px">1-2 Row Cell 2</td>
    </tr>
    <tr style="vertical-align:top">
        <td style="vertical-align:top">2.Row Cell 1</td>
    </tr>
</table>

好的,似乎这与Internet Explorer 11有关,但必须有办法实现此目的!?

2 个答案:

答案 0 :(得分:1)

添加height: 1em;似乎有效 - 就像第一个单元格一样:

<td style="width: 50%; vertical-align: top; height: 1em;">

答案 1 :(得分:1)

所以下面的代码段中有你的解决方案:

table , td, th {
	border: 1px solid #595959;
	border-collapse: collapse;
}
td, th {
	padding: 3px;
	width: 250px;
	height: 150px;
}
th {
	background: #f0e6cc;
}
.even {
	background: #fbf8f0;
}
.odd {
	background: #fefcf9;
}
<table>
	<tbody>
		<tr>
			<td style="height:1em">This is a test thank you for your attention</td>
			<td rowspan="2"></td>
		</tr>
		<tr>
			<td></td>
		</tr>
	</tbody>
</table>

希望有所帮助。