Jquery(或 CSS)将 iframe 自动调整到底部?

标签 jquery css iframe

我不知道如何为距离顶部 300 像素但应该始终到达底部的 iframe 设置属性!

所以目前我将 iframe 的高度设置为 500px。当我调整浏览器窗口大小时,高度应该动态变化。 iframe 应从顶部开始 300 像素并始终到达底部。

我不是 CSS 专家。 知道我必须做什么吗?

    #frame {
 overflow:hidden;
 border:none;
 width:100%;
 height:500px;
 margin-top:300px;
}

最佳答案

html, body { /* Allow the #wrapper div to stretch 100% in both directions */
    height: 100%;
    width: 100%;
    margin: 0;
}
#wrapper { /* necessary because it for some reason doesn't work with the iframe */
    position: absolute;
    top: 300px;
    bottom: 0;
    left: 0;
    right: 0;
}
#frame {
    width: 100%;
    height: 100%;
    border: 0;
}

<div id="wrapper">
    <iframe id="frame" src="http://www.google.com" />
</div>

关于Jquery(或 CSS)将 iframe 自动调整到底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2486548/

相关文章:

iframe - 在一个框架中,因为它将 'X-Frame-Options' 设置为 'SAMEORIGIN, SAMEORIGIN'

php - mysql问题动态下拉

javascript - 表标记内的 jquery 复选框无法访问

javascript - jQuery Slider 无法按设计在移动设备上运行

javascript - 防止jquery分页href重定向

html - 关于页脚的 CSS 小问题

javascript - 类似 iPhone 的 jQuery 滚动条

javascript - jquery 插件和 css

jquery - iframe 与 jquery

javascript - 跨站点嵌入 Web 控件 - 使用 IFrame/Javascript