我的程序人生

关注互联网产品技术学习,应用开发~

DIV+CSS 解决高度自适应办法 兼容多浏览器

2015-8-30 14:51:04 类别:DIV+CSS
摘要:通过隐藏容器溢出和正负内补丁方法解决兼容主流浏览器中DIV布局高度自适应的问题

DIV布局中,高度自适应是常用的一种方法,但往往达到不自己想要的效果. 这里直接贴网上目前通用的方法 利用隐藏溢出和正负补丁方法实现的 高度自适应

01<html>
02<head>
03<title>DIV+CCS 高度自适应解决方案 </title>
04<meta name="description" content="下面介绍采用 隐藏容器溢出 和 正内补丁 和 负外补丁 结合的方法" />
05<style type="text/css"
06<!-- 
07#wrap{overflow:hidden;} 
08#sidebar_left,#sidebar_right{padding-bottom:100000px;margin-bottom:-100000px;} 
09--> 
10</style></head> 
11 
12<body> 
13<div id="wrap" style="width:300px; background:#FFFF00;"
14<div id="sidebar_left" style="float:left;width:100px; background:#FF0000;">Left</div> 
15<div id="sidebar_mid" style="float:left;width:100px; background:#666;"
16 
17</div> 
18<div id="sidebar_right" style="float:right;width:100px; background:#0000FF;">Right</div> 
19</div>
20</body>
21</html>
25次阅读  标签:高度自适应,兼容