如何使用CSS构建iframe效果
iframe应用很普遍,通常的需求有两种:
1,获取iframe效果,就是带一个滚动条,可以省不少版面。
2,要嵌一个页面,实现框架链接。
如果不方便使用iframe,可以有如下解决方案:
第一种需求如果我们使用CSS布局来实现,即可以少一个页面,也可以提高效率。
第二种需求可以采用xmlhttp远程获取。
A.直接模拟iframe
用层做容器
复制代码 代码如下:
#content{overflow:auto;height:200px;width:600px;background:#f00;}
用CSS构建iframe效果 - Css Iframe - * { font:12px Arial;} html { overflow:hidden; border:0; height:100%;} body { overflow:hidden; height:100%;} #content { overflow:auto; height:185px; width:600px; background:#ccc; padding:10px;} 用CSS构建iframe效果
A. 直接模拟iframe,用层做容器
·仅用css编写无限分级弹出菜单 ·浏览器滚动条的参数总结 ·引入css样式表的四种方式介绍 ·两种方式实现的文字竖排效果 ·网页设计高级布局40例参考 ·从GMail认识W3C标准和Ajax
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
用body做容器
复制代码 代码如下:html{overflow:hidden;height:100%;background:#fff;border:0;}
*html{padding:100px00100px;}
body{overflow:scroll;background:#f00;margin:0;position:absolute;top:100px;left:100px;bottom:0;right:0;}
*htmlbody{height:100%;width:100%;}
用CSS构建iframe效果 - Css Iframe - * { font:12px Arial;} html { overflow:hidden; height:100%; background:#fff; border:0;} * html { padding:200px 0 0 100px;} body { overflow:auto; background:#ccc; margin:0; position:absolute; top:200px; left:100px; bottom:0; right:0;} * html body { height:100%; width:100%; position:static;} #info { position:fixed; top:10px; left:10px;} * html #info { position:absolute;} 用CSS构建iframe效果
A. 直接模拟iframe,用body做容器
·仅用css编写无限分级弹出菜单 ·浏览器滚动条的参数总结 ·引入css样式表的四种方式介绍 ·两种方式实现的文字竖排效果 ·网页设计高级布局40例参考 ·从GMail认识W3C标准和Ajax
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
B.绝对定位模拟iframe
滚动条在外边
复制代码 代码如下:html{overflow:hidden;border:0;height:100%;max-height:100%;}
body{overflow:hidden;margin:0;height:100%;max-height:100%;position:relative;}
#head{position:absolute;top:0;right:15px;width:100%;height:100px;background:#f00;z-index:2;}
#foot{position:absolute;bottom:0;right:15px;width:100%;background:#f00;height:50px;z-index:2;}
#content{height:100%;position:relative;z-index:1;overflow:auto;}
效果演示源代码:
用CSS构建iframe效果 - Css Iframe - * { font:12px Arial;} html { overflow:hidden; border:0; height:100%;} body { overflow:hidden; margin:0; height:100%; position:relative;} #content { height:100%; position:relative; z-index:1; overflow:auto;} #head { position:absolute; top:0; right:16px; width:100%; height:100px; background:#ccc; z-index:2;} #foot { position:absolute; bottom:0; right:16px; width:100%; background:#ccc; height:50px;z-index:2;} 用CSS构建iframe效果
B. 绝对定位模拟iframe,滚动条在外边
·仅用css编写无限分级弹出菜单 ·浏览器滚动条的'参数总结 ·引入css样式表的四种方式介绍 ·两种方式实现的文字竖排效果 ·网页设计高级布局40例参考 ·从GMail认识W3C标准和Ajax
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
滚动条在里边
复制代码 代码如下:
html{height:100%;max-height:100%;border:0;overflow:hidden;}
*html{padding:100px050px0;}
body{height:100%;max-height:100%;margin:0;overflow:hidden;}
#content{position:absolute;top:100px;bottom:50px;left:0;right:0;z-index:3;width:100%;overflow:auto;}
*html#content{top:100px;bottom:0;height:100%;}
#head{position:absolute;margin:0;top:0;left:0;width:100%;height:100px;background:#f00;z-index:5;}
#foot{position:absolute;margin:0;bottom:0;left:0;width:100%;height:50px;z-index:5;background:#f00;}
用CSS构建iframe效果 - Css Iframe - * { font:12px Arial;} html { height:100%; max-height:100%; border:0; overflow:hidden;} * html { padding:100px 0 50px 0;} body { height:100%; max-height:100%; margin:0; overflow:hidden;} #content { position:absolute; top:100px; bottom:50px; left:0; right:0; z-index:3; width:100%; overflow:auto;} * html #content { top:100px; bottom:0; height:100%;} #head { position:absolute; margin:0; top:0; left:0; width:100%; height:100px; background:#ccc; z-index:5;} #foot { position:absolute; margin:0; bottom:0; left:0; width:100%; height:50px; z-index:5; background:#ccc;} 用CSS构建iframe效果
B. 绝对定位模拟iframe,滚动条在里边
·仅用css编写无限分级弹出菜单 ·浏览器滚动条的参数总结 ·引入css样式表的四种方式介绍 ·两种方式实现的文字竖排效果 ·网页设计高级布局40例参考 ·从GMail认识W3C标准和Ajax
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
在IE6.0和FF1.5环境下测试通过
-
精选有意义的春节的作文9篇
在平时的学习、工作或生活中,大家都接触过作文吧,借助作文可以提高我们的语言组织能力。那么你知道一篇好的作文该怎么写吗?下面是小编帮大家整理的有意义的春节的作文9篇,仅供参考,欢迎大家阅读。有意义的春节的作文篇1新年是中国传统的节日,一到新年人人都很兴奋。...
-
旅行的意义演讲稿合集6篇
使用正确的写作思路书写演讲稿会更加事半功倍。在社会一步步向前发展的今天,需要使用演讲稿的事情愈发增多,还是对演讲稿一筹莫展吗?以下是小编整理的旅行的意义演讲稿,仅供参考,大家一起来看看吧。旅行的意义演讲稿1尊敬的:世界永久的不变就是不停的改变,时间将一些...
-
劳动的意义的作文(通用49篇)
在平平淡淡的日常中,大家都跟作文打过交道吧,作文根据体裁的不同可以分为记叙文、说明文、应用文、议论文。那么,怎么去写作文呢?下面是小编精心整理的劳动的意义的作文(通用49篇),欢迎大家借鉴与参考,希望对大家有所帮助。劳动的意义的作文篇1为了迎接百年校庆,营造一...
-
青年志愿者进社区活动方案(通用12篇)
为了确保活动有序地进行,常常需要提前准备一份具体、详细、针对性强的活动方案,活动方案是对具体将要进行的活动进行书面的计划。怎样写活动方案才更能起到其作用呢?下面是小编精心整理的青年志愿者进社区活动方案,希望对大家有所帮助。青年志愿者进社区活动方案篇...
相关文章
- Some words for this special occasion英文美文欣赏
- 英语阅读:African Union Leaders Talk Mali, Chinese Investmen
- 高中英语作文:Smart tech makes life simpler
- 如何使用Fireworks制作红墙砖头效果
- springmvc如何整合freemarker 并且兼容jsp 视图
- At Climate Summit, Hope for Emissions Deal美文欣赏
- 如何使用firework制作效果逼真的Philips手机
- j2ee培训:如何构建RESTful Web Service
- 如何使用Fireworks制作炫光效果
- AssistMyFathertoDoExercises初中英语作文