自动设置iframe高度 [英] set the iframe height automatically

查看:72
本文介绍了自动设置iframe高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < iframe src = http://www.google.comstyle =width:90%; height:300px
scrolling =nomarginwidth =0marginheight =0frameborder =0
vspace =0hspace =0>

我试图将高度设置为自动,以便帧自动调整为页面长度不得不像我在这里做的那样硬编码高度。我试过 height:auto height:inherit 但它没有用。


<尝试编码

 < div>解析方案


< iframe id ='iframe2'src =Mypage.aspxframeborder =0style =overflow:hidden; height:100%;
width:100%; position:absolute; >< / iframe中>
< / div>


I need to embed an HTML page inside a frame, and am using the following code:

<iframe src="http://www.google.com" style="width: 90%; height: 300px"
    scrolling="no" marginwidth="0" marginheight="0" frameborder="0"
    vspace="0" hspace="0">

I am trying to make the height set to auto so that the frame auto resizes to the page length without having to hardcode the height as I am doing here. I tried height:auto and height:inherit but it did not work.

解决方案

Try this coding

<div>
    <iframe id='iframe2' src="Mypage.aspx" frameborder="0" style="overflow: hidden; height: 100%;
        width: 100%; position: absolute;"></iframe>
</div>

这篇关于自动设置iframe高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆