Search code examples
htmlcssiframeembed

How do I make an HTML iFrame fit the whole page without needing to scroll?


I need to use an iFrame within another page, and I want to make it fit the entire web page that it's embedding without the need to scroll. So, how can I set the iFrame height to the height of the web page?

I tried just setting the iFrame height to 100%, but for obvious reasons, that did not work.

I'm sure the answer is simple, I'm better at the back end.


Solution

  • html,body{
                width:100%;
                height:100vh;
                overflow:hidden;
                margin:0px;
                padding:0px;
                border:none;
            }
            iframe{
                width:100%;
                height:100vh;
                overflow:hidden;
                margin:0px;
                padding:0px;
                border:none;
            }
    <iframe src="https://blogger.com" name="otherSite"></iframe>