如何制作 html iframe 100% 宽度和高度?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3306124/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to make a html iframe 100% width and height?
提问by Hymansta
how do I make an iframe 100% width and height of the window?
如何使 iframe 具有 100% 宽度和高度的窗口?
回答by mikel
this code probable help you .
这段代码可能会帮助你。
<iframe src="" onload="this.width=screen.width;this.height=screen.height;">
回答by smallworld
Answering this just in case if someone else like me stumbles upon this post among many that advise use of JavaScripts for changing iframe height to 100%.
回答这个以防万一,如果像我这样的其他人在许多建议使用 JavaScript 将 iframe 高度更改为 100% 的人中偶然发现了这篇文章。
I strongly recommend that you see and try this option specified at How do you give iframe 100% heightbefore resorting to a JavaScript based option. The referenced solution works perfectly for me in all of the testing I have done so far. Hope this helps someone.
我强烈建议您查看并尝试在求助于基于 JavaScript 的选项之前如何为 iframe 提供 100% 高度中指定的此选项。引用的解决方案在我迄今为止所做的所有测试中都非常适合我。希望这可以帮助某人。