我在查询MySQL数据库并使用脚本将结果放入自动生成的HTML文件中。HTML CSS两个相同高度和宽度的2列表格
我有两列需要并排摆放2列和4行。
我已将我的HTML & css放在小提琴中。
http://jsfiddle.net/mika6891/7b0k049r/1/
我的HTML代码:
<!-- gene description -->
<div id="container">
<div id="gene_A_description" >GENE - A</div>
<div id="gene_B_description" >GENE - B</div>
</div>
<div id="container">
<table id="gene_A_text" class="listitems2">
<tr>
<td><b>test1</b></td>
<td><!--test1-->test1</td>
</tr>
<tr>
<td><b>test2</b></td>
<td><!--test2-->test2</td>
</tr>
<tr>
<td><b>test3</b></td>
<td><!--test3-->test3</td>
</tr>
<tr>
<td><b>test4</b></td>
<td><!--test4-->test test test test test test test test test test test test test test test test</td>
</tr>
</table>
<div id="container">
<table id="gene_A_text" class="listitems2">
<tr>
<td><b>test1</b></td>
<td><!--test1-->1</td>
</tr>
<tr>
<td><b>test2</b></td>
<td><!--test2-->+</td>
</tr>
<tr>
<td><b>test3</b></td>
<td><!--test3-->test3</td>
</tr>
<tr>
<td><b>test4</b></td>
<td><!--test4-->test test </td>
</tr>
</table>
<div id="container">
<div id="gene_A_description" >GENE - C</div>
<div id="gene_B_description" >GENE - D</div>
</div>
我的CSS代码
table{
font-family:Arial;
border-collapse: separate;
border-spacing: 10px;
}
#container{
width: 500px;
margin-left: auto;
margin-right: auto;
}
#gene_A_description{
width:200px;
height:50px;
background-color:#e13737;
color:white;
text-align:center;
margin-top: 30px;
float: left;
font-family: 'Arial Black', Gadget, sans-serif;
line-height: 50px;
}
#gene_B_description{
width:200px;
height:50px;
background-color:#e13737;
color:white;
text-align:center;
margin-top:30px;
float: right;
font-family: 'Arial Black', Gadget, sans-serif;
line-height: 50px;
}
table.listitems2 {
width: 150px;
margin-left: auto;
margin-right: auto;
}
#gene_A_text{
float:left;
}
#gene_B_text{
float:right;
}
现在这些HTML会自动生成所以GENE_A_TEXT和GENE_B_TEXT表永远不会包含相同信息等也不会相同,正如可以在示例中看到的(因为test4行)。
我希望表GENE_A_TEXT和GENE_B_TEXT中的相同行具有相同的高度,具体取决于其中的信息量。所以,我的下一个GENE_C_DESCRIPTION和GENE_D_DESCRIPTION开始在同一高度,而不是像现在,他们都放在下面GENE_B_TEXT
这是应该如何看起来像
我不明白你想要什么。您能否上传您想要的设计的图片/插图?它会更容易... – TamarG
@TamarG off课程,我很抱歉。 – user1987607
你的标题应该在同一张表中,因为它们目前是分开的。 – Prasad