有没有办法让两列在高度上相互匹配,而不使用表格单元格,固定高度或Javascript?即使列高度不使用TABLE
使用表
<table>
<tr>
<td style="background:#F00;">
This is a column
</td>
<td style="background:#FF0;">
This is a column<br />
That isn't the same<br />
height at the other<br />
yet the background<br />
still works
</td>
</tr>
</table>
使用的DIV
<div style="float:left;background:#F00" >
This is a column
</div>
<div style="float:left;background:#FF0" >
This is a column<br />
That isn't the same<br />
height at the other<br />
yet the background<br />
still works
</div>
<div style="clear:both;" ></div>
的目标是使双方的背景,无论扩展全高哪一方较高。
将其中一个嵌套在另一个不起作用,因为它不能保证两边都是正确的高度。
不幸的是,预览显示了正常工作的HTML,但实际的文章已将其删除。你应该可以将它粘贴到一个HTML文件中,看看我的意思。
可能的重复[在双列页面上,如何使用CSS或Javascript将左侧div增长到与右侧div相同的高度?](http://stackoverflow.com/questions/35699/on-一个两列的页面如何可以生长左边的高度相同的高度) – outis 2012-06-15 17:40:11