All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
新瓶旧酒ASP.NET,AJAX(4),-,(客户端脚本编程,JavaScript基本类型扩展)_[Asp.Net教程]
提高asp.net网站性能的7个方法_[Asp.Net教程]
ASP.NET,FORUMS换肤流程_[Asp.Net教程]
入门知识:动态网页PHP编程中数组的基础知识_php资料_编程技术
delphi弹出菜单组件(TPopMenu)
动态网页制作技术PHP的基础知识_php资料_编程技术
PHP一生成柱状图、横柱图、折线图的类_[PHP教程]
SQL Server 索引基础知识(4)----主键与聚集索引_[SQL Server教程]
Linux操作系统启动httpd失败的解决方法_php资料_编程技术
PHP和AJAX打造高级RSS聚合器_php资料_编程技术
Reading number is top 10 pictures
Small s breast enhancement demonstration
全身蕾丝丝质美臀
The service WaLiangGe Chinese aircraft carrier1
Sora aoi mirror memorial classics5
八个盛产美女的国家2
A cat have life principles
Seductive beauty of crime1
In the world the most mysterious 21 place landscape2
This is heaven to some path
人美胸美腿更美2
Download software ranking
C++教程第四版
WebService在.NET中的实战应用教学视频 → 第3集
美女写真3
asp.net技术内幕
Eclipse 4.2.1 For Win32
Call Of Duty2
Sora aoi 120 minutes
C++编程教程第三版
Photoshop 8.0图象编辑软件
SP4 for SQL2000
归海一刀 published in(发表于) 2014/3/30 5:36:50 Edit(编辑)
高度100%的绝对定位自适应布局技巧_[Html教程]

高度100%的绝对定位自适应布局技巧_[Html教程]

高度100%的绝对定位自适应布局技巧_[Html教程]

 容器高度100%是经常用到的需求,任何容器都可以实现,而且不需要嵌套关系。

把body看作是一个容器,做为内部对象的上层标签,他的高度设置为100%是关键。

最基本的例子

* { margin:0; padding:0; border:0;}
html,body { height:100%;} /* 同时设置html是为了兼容FF */
#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:40%; height:100%; background:#f00; z-index:2;}
#box_2 { position:absolute; top:0; right:0; width:60%; height:100%; background:#000; z-index:1;}

这种布局是不需要float的,还可以有很多变化:

1,N列布局
2,N行布局
3,N列加N行交叉布局

值得注意的是在FF下浏览相对大小容器页面时,调整窗口大小的同时容器大小进行实时调整,而IE只会在窗口调整完毕后才出效果。




 
 
 
 
 


添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.