我是靠谱客的博主 羞涩小懒猪,这篇文章主要介绍嵌套页面Iframe实现高度自适应,现在分享给大家,希望可以做个参考。

跨域Iframe实现高度自适应:
<html>
    <head>
        <style>
            body {margin-left: 0px;
                margin-top: 0px;
                margin-right: 0px;
                margin-bottom: 0px;
                overflow: hidden
            }
        </style>
    </head>
    <body>
        <iframe src='http://baidu.com/' width='100%' height='100%' frameborder='0' name="_blank" id="_blank" >       </iframe>
    </body>
</html>
 
 
 
注意三点.
 
1. 文件开头不能是:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
必须 是<html>开头
2. body样式中的 overflow: hidden; 绝对不对省略;
3.Iframe 中的 height='100%' 以及 滚动条不能设为no(默认是yes,不用设置即可)

最后

以上就是羞涩小懒猪最近收集整理的关于嵌套页面Iframe实现高度自适应的全部内容,更多相关嵌套页面Iframe实现高度自适应内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(190)

评论列表共有 0 条评论

立即
投稿
返回
顶部