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

HtmlIframe

Html Problem Overview


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

Html Solutions


Solution 1 - Html

This code probably help you.

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

Solution 2 - Html

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 https://stackoverflow.com/questions/5272519/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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJackstaView Question on Stackoverflow
Solution 1 - HtmlmikelView Answer on Stackoverflow
Solution 2 - HtmlsmallworldView Answer on Stackoverflow