Skip to content Skip to sidebar Skip to footer

Absolute Position Elements Within Iframe?

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

Solution 1:

Basically, in an iframe you load a different website or webpage.

The scripts, elements and CSS have to be controlled from within that page.

Solution 2:

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

Post a Comment for "Absolute Position Elements Within Iframe?"