如何使 iframe 响应移动设备?
How to make an iframe responsive for mobile?
我正在尝试将 iframe 对象嵌入到我的 wordpress 网站的页面上。我能够嵌入 iframe,但是,该对象会在移动设备的屏幕上运行。这是我要嵌入的 iframe
<div style="display:block;margin:0;padding:0;border:0;outline:0;font-size:10px!important;color:#AAA!important;vertical-align:baseline;background:transparent;width:1000px;">
<iframe frameborder="0" height="1000" scrolling="no" src="https://secure.rightsignature.com/templates/7304f97a-bbbb-4dc7-b48d-6d6a5ac41b5c/template-signer-link/267cd399a88df2a2616ab109b61f7bb5" width="1000"></iframe>
</div>
我试图用 div class:
包装上面的整个代码
div class="right-signature"
然后使用我在另一篇论坛文章中找到的以下 CSS:
.right-signature {
position: relative;
padding-bottom: 50%;
height: 0;
overflow: hidden;
}
.right-signature iframe {
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
}
但我没能成功。有谁知道我可以做些什么来让它在移动设备上运行?
我想通了...我最终没有添加任何自定义 CSS 来解决问题。我只需要将 iframe 宽度从 1000px 更改为 100%。
我正在尝试将 iframe 对象嵌入到我的 wordpress 网站的页面上。我能够嵌入 iframe,但是,该对象会在移动设备的屏幕上运行。这是我要嵌入的 iframe
<div style="display:block;margin:0;padding:0;border:0;outline:0;font-size:10px!important;color:#AAA!important;vertical-align:baseline;background:transparent;width:1000px;">
<iframe frameborder="0" height="1000" scrolling="no" src="https://secure.rightsignature.com/templates/7304f97a-bbbb-4dc7-b48d-6d6a5ac41b5c/template-signer-link/267cd399a88df2a2616ab109b61f7bb5" width="1000"></iframe>
</div>
我试图用 div class:
包装上面的整个代码div class="right-signature"
然后使用我在另一篇论坛文章中找到的以下 CSS:
.right-signature {
position: relative;
padding-bottom: 50%;
height: 0;
overflow: hidden;
}
.right-signature iframe {
position: absolute;
top:0;
left: 0;
width: 100%;
height: 100%;
}
但我没能成功。有谁知道我可以做些什么来让它在移动设备上运行?
我想通了...我最终没有添加任何自定义 CSS 来解决问题。我只需要将 iframe 宽度从 1000px 更改为 100%。