gpt4 book ai didi

html - 如何使所有三个表显示在同一高度

转载 作者:行者123 更新时间:2023-11-28 04:57:01 25 4
gpt4 key购买 nike

我有三个表 table1,table2,table3 都包裹在一个表中,同时向表中添加不同大小的内容,每个表扩展到不同的高度,即使添加不同大小的内容,如何使所有三个表显示在相同的高度内容

HTML:

<div class="csdiv">
<table cellpadding="2" cellspacing="0">
<tr valign="top">
<td>
<table class="cstable" width="100%" height="265">
<tr height="35">
<th width="33%" nowrap>Table1</th>
</tr>
<tr>
<td valign="top" bgcolor="FFFFFF" width="275">


</td>
</tr>
</table>
</td>
<td>
<table class="cstable" width="100%" height="265">
<tr height="35">
<th nowrap width="34%" nowrap>Table2</th>
</tr>
<tr>
<td valign="top" bgcolor="FFFFFF" width="275">

</td>
</tr>
</table>
</td>
<td>
<table class="cstable" width="100%" height="265">
<tr height="35">
<th nowrap width="33%" nowrap>Table3</th>
</tr>
<tr>
<td valign="top" bgcolor="FFFFFF" width="275">


</td>
</tr>
</table>
</td>
</tr>
</table>
</div>

CSS:

.csdiv {
font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
font-size: 12px;
line-height: 1em;
}
.cstable {
border-collapse: collapse;
border-color: #666666;
border-style: solid;
border-width: 1px;
font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
font-size: 12px;
line-height: 1em;
}
.cstable th {
background-color: #A3C2FF;
border-collapse: collapse;
border-color: #666666;
border-style: solid;
border-width: 1px;
color: #000000;
font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
font-size: 12px;
font-weight: bold;
line-height: 1em;
text-align: left;
}

JSFIDDLE:DEMO

最佳答案

你的父元素没有设置height,所以table的高度只等于内容。要让它全高,添加

 html,body{
height:100%; /*give full height to document */
width:100%;
margin:0;
padding:0;
}
table{
height:100%; /* stretch table to parents height*/
}

demo

关于html - 如何使所有三个表显示在同一高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21042195/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com