Let's suppose I have an iframe
and it loads a page by a URL. Is it possible to make sure its width
and height
will be of the exact size of the page it contains upon loading it using CSS only?
Asked
Active
Viewed 86 times
2

Lajos Arpad
- 64,414
- 37
- 100
- 175
-
Are you asking how to make the iframe fill the page? Otherwise, what do you mean by "exact size of the page it contains"? – 4castle Aug 10 '16 at 19:45
-
No, the question is about Page1 loading Page2 through an iframe and I wish to make sure the size of the iframe will match the size of Page2 which will be loaded inside it. So, I wish to make sure that no scroll bars are needed inside the iframe, for example. – Lajos Arpad Aug 10 '16 at 19:46
-
There are several dupes to your question, [this](http://stackoverflow.com/q/819416/5743988), [this](http://stackoverflow.com/q/9975810/5743988), [this](http://stackoverflow.com/q/15255858/5743988), [this](http://stackoverflow.com/q/24157940/5743988). What have you tried? – 4castle Aug 10 '16 at 19:51
-
The first allows Javascript solutions – Lajos Arpad Aug 10 '16 at 19:51
-
The second allow Javascript solutions as well – Lajos Arpad Aug 10 '16 at 19:52
-
The third question is about displaying an iframe in 100% of the page's width and height. None of the three dupes were actual dupes. – Lajos Arpad Aug 10 '16 at 19:54
-
As about the things I have tried: I absolutely do not know how should this be done, therefore I have searched for CSS solutions. Since I did not find any, I concluded that this is worth to be asked as a question. – Lajos Arpad Aug 10 '16 at 19:55
-
The closest one I've found is [this question](http://stackoverflow.com/q/24157940/5743988). Considering there are no accepted or upvoted answers, and it's been viewed 25k times, I don't think this is possible. – 4castle Aug 10 '16 at 20:01
-
@4castle, you are probably right, but let's leave this question opened for a while. If there is no info about it, then I will try to research the matter more deeply. There is a Javascript solution though, but that will not work if Javascript is switched off, so, as far as I know, there is no bullet-proof solutions for this, but I might be wrong. – Lajos Arpad Aug 10 '16 at 20:09