最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
css 容器高度100%及相对高宽
时间:2008-06-10 编辑:简简单单 来源:一聚教程网
* { 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%; 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测试通过
-
上一个: 经典分页代码样式
-
下一个: CSS命名规范一 入门篇
相关文章
- 解决css中父div高度不随子div高度变化的方法 04-18
- CSS等比列放大缩小效果(宽度和高度) 03-22
- ie6不支持css max-heigth 最大高度解决办法集 03-02
- CSS技巧:解决div列高度自适的2种常用方法 01-26
- CSS 鼠标点击拖拽效果代码展示 10-31
- CSS使用SVG实现动态分布的圆环发散路径动画教程 10-31