Reputation: 927
I want to absolute position an element in iframe relative to the document. I'm using this
.myClass
{
position: absolute;
top: 0;
left: 0;
}
but it do not position the element at top left of document, it's positioned at top left of the iframe. How to apsolute position it to the document? jquery/javascript solutions are acceptable
Upvotes: 2
Views: 4995
Reputation: 3380
var iframe = top.frames[name].document;
var css = '' +
'<style type="text/css">' +
'body{margin:0;padding:0;postiton:absolute}' +
'</style>';
iframe.open();
iframe.write(css);
iframe.close();
You have to do that in HTML not in the css file. But the inner style of the object in the iframe must be handled in the css of the website/server from where the page loads
Upvotes: 2
Reputation: 78971
Basically, in an iframe
you load a different website or webpage.
The scripts, elements and CSS have to be controlled from within that page.
Upvotes: 2