Is there a way to shrink what's inside an iframe without adjusting css?
any magical 'zoom' parameter out there?!!!
I have a 600px preview iframe i want to fit a 1000px site in without scrollbars...
Just multiply the original dimensions by the zoom ration you want to use. For example, if you want to scale to 71% as shown in the example below, 1000px x 2000px becomes 710px x 1420px. The zoom factor is input for the zoom , -moz-transform , -o-transform , and -webkit-transform properties.
You can easily resize iFrames using HTML and/or CSS, and even make them resizable so they'll adjust automatically based on the user's screen size.
When you can communicate with the code inside an iFrame, you can make any change you want to the code within that iFrame.
CSS3 can handle this. This bit of code should handle most all browsers or simply reduce it to fit your needs. No need to "adjust" any existing CSS:
iframe { -moz-transform: scale(0.25, 0.25); -webkit-transform: scale(0.25, 0.25); -o-transform: scale(0.25, 0.25); -ms-transform: scale(0.25, 0.25); transform: scale(0.25, 0.25); -moz-transform-origin: top left; -webkit-transform-origin: top left; -o-transform-origin: top left; -ms-transform-origin: top left; transform-origin: top left; }
Or if you want inline style for example just firefox:
<style> #IDNAME { -moz-transform: scale(0.25, 0.25); -moz-transform-origin: top left; } </style>
Then of course simply add the ID to your iframe:
<iframe id="IDNAME" src="http://www.whatever.com"></iframe>
If you control the Iframe-content, you might find this little hack of mine useful: http://futtta.be/squeezeFrame/
It's a cross-browser standalone javascript thingy that tries to automatically adjust the size of the page it's called from to the available size of the Iframe using css zoom and moz-transform.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With