展会信息港展会大全

css 容器高度100%及相对高宽
来源:互联网   发布日期:2016-03-25 16:02:44   浏览:1588次  

导读:* { margin:0; padding:0; border:0;} html,body { height:100%;} #box_2 { height:100%; background:#000;} 绝对定位重叠效果 #box_1 { position:absolute; top:0; left:0; width:100%; height:50px; background:#f00; z-index:2;} #box_2 { position:absol...

* { margin:0; padding:0; border:0;}

html,body { height:100%;}

#box_2 { height:100%; background:#000;}

绝对定位重叠效果

#box_1 { position:absolute; top:0; left:0; width:100%; height:50px; background:#f00; z-index:2;}

#box_2 { position:absolute; left:0; top:0; width:100%; height:100%; background:#000; z-index:1;}

纵向高度相对大小效果

#box_1 { position:absolute; top:0; left:0; width:100%; height:30%; background:#f00; z-index:2;}

#box_2 { position:absolute; left:0; top:30%; width:100%; height:70%; background:#000; z-index:1;}

横向宽度相对大小效果

#box_1 { position:absolute; top:0; left:0; width:30%; height:100%; background:#f00; z-index:2;}

#box_2 { position:absolute; top:0; right:0; width:70%; height:100%; background:#000; z-index:1;}

实际应用中,可有很多变化,轻松实现没有嵌套的绝对或相对多列竖排、横排。IE6.0和FF1.5测试通过

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港