开发者

how to make a html iframe 100% width and height? [duplicate]

开发者 https://www.devze.com 2023-01-08 21:25 出处:网络
This question already has answers here: 开发者_高级运维 Full-screen iframe with a height of 100%
This question already has answers here: 开发者_高级运维 Full-screen iframe with a height of 100% (20 answers) Closed 8 years ago.

how do I make an iframe 100% width and height of the window?


This code probably help you.

<iframe src="" onload="this.width=screen.width;this.height=screen.height;">


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%.

I strongly recommend that you see and try this option specified at How do you give iframe 100% height before 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消