根据iframe内部加载的内容自动调整div / iframe的大小

| 我在网上看到很多相互矛盾的信息,而且我认为这里的人们比其他大多数地方都知道更多。 是否可能有一个带有iframe的div,它会自动调整宽度(甚至可能是高度)-> WITHOUT <-使用javascript ..也需要具有跨浏览器功能(像lynx和ie5这样的浏览器不在乎所有)。 几天来,我一直在网上修改并关注各种人的建议,但是我仍然看不到我的div和iframe将其宽度限制为iframe中正在加载的任何数据(只是随机信息表)。 这是我拥有的一些CSS和相关的html,正如您所知,它经过了一些没有width的修订:auto;高度:自动等
            div#topleftdiv
                {
                    float: left;
                    width: 25%;
                    height: auto;
                }

            iframe#topleftframe
                {
                    background-color: transparent;
                    -moz-opacity: .00;
                    filter: alpha(opacity=00);
                }


            div#toprightdiv
                {
                    float: right;
                    width: 25%;
                    height: auto;
                }

            iframe#toprightframe
                {
                    background-color: transparent;
                    -moz-opacity: .00;
                    filter: alpha(opacity=00);
                }

            div#topmiddlediv
                {
                    float: left;
                    width: 49%;
                    height: auto;
                    text-align: center;
                    align: center;
                    margin-left: auto;
                    margin-right: auto;
                }

            iframe#topmiddleframe
                {
                    width: 100%;
                    height: 40em;
                    text-align: center;
                    align: center;
                    margin-left: auto;
                    margin-right: auto;
                    -moz-border-radius: 15px;
                    border-radius: 15px;
                }

            div#bottomdiv
                {
                    clear: both;
                }
<div id=\"topleftdiv\" scrolling=\"no\">
    <iframe id=\"topleftframe\" name=\"topleftframe\" scrolling=\"no\"  allowtransparency=\"true\" frameBorder=\"0\">
    </iframe>
</div>
<div id=\"toprightdiv\" scrolling=\"no\">
    <iframe id=\"toprightframe\" name=\"toprightframe\" scrolling=\"no\" allowtransparency=\"true\" frameBorder=\"0\">
    </iframe>
</div>
<div id=\"topmiddlediv\" scrolling=\"no\">
    <iframe id=\"topmiddleframe\" name=\"topmiddleframe\" scrolling=\"no\" allowtransparency=\"true\" frameborder=\"0\" noresize>
    </iframe>
</div>
    
已邀请:
        不,不可能。您需要JavaScript才能将帧大小传递回父窗口。 基本的JavaScript,如果您改变主意: 从iFrame:
parent.document.getElementById(\'iframe_id\').style.height =
    document.body.offsetHeight;
    

要回复问题请先登录注册