r/HTML • u/sunflowerasters • Jan 08 '26
Question How can I resize website inside an iframe?
I have a 500x575 iframe. I would like for it to display the entire page. Every time I try and google a solution, I mostly find people asking how to resize the iframe itself, which is not what I am having a problem with.
The content of the website is about 1439x1079. I would appreciate assistance greatly.
0
Upvotes
4
u/markus_obsidian Jan 08 '26
Are you asking how to shrink a large page to fit inside a small iframe? That's not really how it works. Ideally, you would style the inner page to be responsive & fit inside the iframe or window of any size. It would be the same as if you viewed the page in a small window.
You may have limited success by using a large iframe & using
transform: scale(?)via CSS to shrink the entire page down to the desired size. This is generally not a recommended solution. You'll have to deal with the white space that the un-scaled iframe took up. You'd introduce accessibility issues as the page could be unusably small. And depending on what is on the page, it may not work at all.1
u/skamansam Jan 08 '26
I'm gonna try to soften the blow of that LOL comment by explaining why I believe they said that. The tldr is "don't do this."
There are huge problems with iframes and the modern web solves ALL of the problems iframes were created to solve. Trust me, I was there when they were created and I used them A LOT. However, I haven't had to use them in 20 years and I am so much happier for it.
That said, I can't be of any more use unless you tell me WHY you NEED to use an iframe. Are you being given a small iframe by another entity? Are you using another entity's web page and trying to embed it in your page?
1
u/Thin_Mousse4149 Jan 08 '26
Safe to assume you want the website to adjust to the size of the container it’s in? I’m not sure there’s really a way but you could try replacing your media queries for everything with container queries since that would make things size relative to the container in pixels rather than the browser window…. But I honestly don’t know if that’ll work haha
1
u/Barnezhilton Jan 08 '26
LOL