日期:2014-05-16 浏览次数:20443 次
<!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>
<title></title>
<style>
#container{min-height:200px;}
#one{float:left; height:300px; width:200px; background-color:Red;}
#two{float:left; height:100%;width:200px; background-color:green;}
</style>
</head>
<body>
<div id="container">
<div id="one"></div>
<div id="two">asdad</div>
</div>
</body>
</html>
<!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>
<title></title>
<style>
#container{min-height:200px;}
#one{float:left; height:300px; width:200px; background-color:Red;}
#two{float:left; width:200px; background-color:green;}
</style>
</head>
<body>
<div id="container">
<div id="one"></div>
<div id="two">asdad</div>
</div>
<script type="text/javascript">
document.getElementById('two').style.height = document.getElementById('one').offsetHeight + 'px';
</script>
</body>
</html>