<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>两列div高度需要自适应的问题</title>
<style>
*{ margin:0px; padding:0px;}
#wrap{ width:776px; border:1px solid #f00; background: url(bg1.png) repeat; overflow:auto;}
#cloumn1{ float:left; width:298px; border:1px solid #ccc;}
#cloumn2{ float:right; width:474px; border:1px solid #00F;}
.clear{ clear:both;}
</style>
</head>
<body>
<div id="wrap">
<div id="cloumn1">
<p>cloumn1</p>
<p>cloumn1</p>
<p>cloumn1</p>
</div>
<div id="cloumn2">
<p>cloumn2</p>
<p>cloumn2</p>
<p>cloumn2</p>
<p>cloumn2</p>
<p>cloumn2</p>
<p>cloumn2</p>
<p>cloumn2</p> <p>cloumn2</p>
</div>
<div class="clear"></div>
</div>
<script language="javascript" type="text/javascript">
function $(id){return document.getElementById(id);}
if($("cloumn1").clientHeight>$("cloumn2").clientHeigth)
$("cloumn2").style.height=$("cloumn1").offsetHeight+"px";
else
$("cloumn1").style.height=$("cloumn2").offsetHeight+"px";
</script>
</body>
</html>