I want to embed a website in a WordPress page of another website.
the iframed website is a contact form processing page in asp, and it is not responsive.
Could I wrap this in a div tag that is responsive or can I make an iFrame responsive?
thanks.
I want to embed a website in a WordPress page of another website.
the iframed website is a contact form processing page in asp, and it is not responsive.
Could I wrap this in a div tag that is responsive or can I make an iFrame responsive?
thanks.
You must be logged in to post a comment.
Depends what you want the iframe to be responsive to: to changes of the containing block or to changes of content inside the iframe.
If you want the iframe to adapt to the size of the containing block (e.g. user resizes browser window), you might want to add relative dimensions using percentage values to the iframe element, e.g., by way of a stylesheet:
For this to work, you also need the html and body set to 100% height, don’t ask my why 🙂 but this magic just works.
Example: http://jsfiddle.net/4z2hn/
I’d like to add my personal opinion: Preferably, JavaScript should not be used to solve a layout issue. For that, use CSS instead. The power of the current CSS implementations allow for stylistic flexibility and provide design possibilities which where unavailable before. Only if all else fails, resort to a scripted solution.
Not sure what elements are on the contact form asp page.
You can try the method to resize via jquery.
from How do you create auto resizing a iframe when you make your browser smaller?
Or use the other method.
Resizing an iframe’s width on window resize
It depends on the contents inside the frame how well that resize actually works for you. But it is a start.
To resize and keep original proportions.
X / newWidth = originHeight / originWidth
X = newWidth * (originHeight / originWidth )
X = New Height
See here:
https://jsfiddle.net/koaab543/2/
You cannot make iframe content responsive if it is not your page. You can add iframe style
to make iframe wrapper responsive.
But content in it – will be the same as it was – (as I said – unless it is your page also)