• λ我爱Aspx >> Asp.Net >> 用CSS构建iframe效果
  • 用CSS构建iframe效果

  • :未知  Դ:internet  :2007-5-20 16:45:33  ؼ:
  • iframe应用很普遍,通常的需求有两种:

    1. 获取iframe效果,就是带一个滚动条,可以省不少版面。

    2. 要嵌一个页面,实现框架链接。

    如果不方便使用iframe,可以有如下相应解决方案:

    1. 可以使用css布局来实现,即可以少一个页面,也可以提高执行效率。

    2. 可以采用xmlhttp远程获取数据。

    A. 直接模拟iframe

    用层做容器

    程序代码

    #content { overflow:auto; height:200px; width:600px; background:#f00;}

    效果演示:http://www.rexsong.com/blog/attachments/200601/02_150246_cssiframe1.htm

    用body做容器

    程序代码

    html { overflow:hidden; height:100%; background:#fff; border:0;}

    * html { padding:100px 0 0 100px;}

    body { overflow:scroll; background:#f00; margin:0; position:absolute; top:100px; left:100px; bottom:0; right:0;}

    * html body { height:100%; width:100%;}

    效果演示:http://www.rexsong.com/blog/attachments/200601/02_151517_cssiframe2.htm

    B. 绝对定位模拟iframe

    滚动条在外边

    程序代码

    html { overflow:hidden; border:0; height:100%; max-height:100%;}

    Ҷƪл˵?
  • һƪ为什么要使用 CSS?
    һƪAjaxHelper Flat v0.7 下载