div+css 自适应高度

<!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/1ArrayArrayArray/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Div + CSS padding-bottom:-99999px;</title> 
<style type="text/css"> 
.wrap{overflow:hidden;width:300px; background:#FFFF00;} 
.sidebar_left,.sidebar_right{padding-bottom:100000px;margin-bottom:-100000px;} 
.sidebar_left{float:left;width:100px; background:#FF0000;}
.sidebar_mid{float:left;width:100px; background:#666;}
.sidebar_right{float:right;width:100px; background:#0000FF;}
</style>
</head> 

<body> 
<div class="wrap"> 
<div class="sidebar_left">Left</div> 
<div class="sidebar_mid"> 
<p>height:auo;</p>
<p>padding-bottom</p>
</div> 
<div class="sidebar_right">Right</div> 
</div> 
</body> 
</html>
支持ie6 7 8
<script typescripttype="text/javascript">
<!-- 
window.onload=window.onresize=function(){ 
if(document.getElementById("sidebar_left").clientHeight<document.
getElementById("sidebar_left").clientHeight){ 
document.getElementById("sidebar_right").style.height=document.
getElementById("sidebar_left").offsetHeight+"px"; 

else{ 
document.getElementById("sidebar_left").style.height=document.
getElementById("sidebar_right").offsetHeight+"px"; 

 

-->
</script>
<div id="pro-left">
</div>
<div id="pro-right">
 test
</div>

你可能感兴趣的:(div+css,div+css,自适应高度,自适应高度)