Home > OS >  How can I set the height of the iframe equal to website shown in it?
How can I set the height of the iframe equal to website shown in it?

Time:01-19

I'm not so expert, I'm trying to embed an external website into a page of mine with <iframe src="http://...>, I'm setting the width with a simple CSS rule, but I want to set the height equal to the height of the website shown in the iframe, how can I do it?

The website shown is an e-shop, the iframe shows a page with some products, I want that the iframe height grows when the page grows. If the page shown height is 2000px, the iframe height will be 2000px, if the screen width is smaller and the page shown height become 3400px, the iframe height will become 3400px, exc...

There is a way to do this? Thank you!

CodePudding user response:

You can also try this on the ruleset for iframe:

height: 100% !important;

CodePudding user response:

You can achieve this using CSS. Make a ruleset for iframes and adding a declaration: height: 100%

CodePudding user response:

you can use vh unit:

height: 100vh;

  •  Tags:  
  • Related