Is there a way to make the height of the <iframe>
reach exactly the bottom of the page? It is hard to judge by using height:xx%
, and it might be dependent on browser.
The code is below:
<!DOCTYPE html>
<html>
<body style="margin:0">
<p style="margin:10px"> hello </p>
<iframe src="http://www.weather.com" style="width:100%; height:95%"></iframe>
</body>
</html>
If your
<p>
tag content is fixed then you can try this way by adjusting the height of<p>
and<iframe>
relatively..and you have to keep<html>
OR<body>
tag height 100% otherwise it wont workI have always used height:100vh; to give you 100% of the view port
Try this...
You could check the demo here
Iframe which is a child to the body element is of 100% height with it's parent and before you can make
iframe
full page you have to declare the height of thebody
and make it full page too.Try this. (I thought it would be better if you put your CSS in an external file or just inside the
head
)I had this same problem recently. I believe you are wanting to expand the height to fit the content that is dynamically loaded. This works like a dream. :)
Demo