找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 982|回复: 0

div+css 自适应高度

[复制链接]
发表于 2013-4-2 16:14:46 | 显示全部楼层 |阅读模式 来自 北京市
[code=Xml width=600px]<!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> [/code]

发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;

如何回报帮助你解决问题的坛友,好办法就是点击帖子下方的评分按钮给对方加【金币】不会扣除自己的积分,做一个热心并受欢迎的人!

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则 需要先绑定手机号

关闭

站长推荐上一条 /1 下一条

QQ|侵权投诉|广告报价|手机版|小黑屋|西部数码代理|飘仙建站论坛 ( 豫ICP备2022021143号-1 )

GMT+8, 2024-5-22 05:43 , Processed in 0.037177 second(s), 9 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表