I have an iframe
that embeds a pdf from a folder into the website. I want that iframe
to cover the full page. I did width: 100%
, and that covered the page for width, but if I do height: 100%
, it doesn’t even cover half of the page. How can I cover the full page with an iframe
. One last thing, I have checked other answers and those don’t help me, I have also tried to use embed and object tags but those don’t work either.
The line of code:
<iframe src="/static/HowToPay.pdf" width="100%" height="1000px"></iframe>
4
Answers
use this CSS that set the height and cover the full page
We have property
vh
for get available window height.Did you try using
vh
andvw
units within astyle
attribute?You can check the preview by running the snippet
Pervious answers offer ссs solution but I want to suggest Fullscreen API. Maybe will be usefull
https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API
Easy way to use it is
react-full-screen
: https://www.npmjs.com/package/react-full-screen