How to make width and height of iframe same as its parent div?

you have a lot of typos.

a correct markup should be like:

<iframe src="https://stackoverflow.com/questions/18765762/./myPage.aspx" id="myIframe" scrolling="no" frameborder="0"
    style="position: relative; height: 100%; width: 100%;">
...
</iframe>

also, if this frame already has an ID, why don’t you put this in CSS like this (from a separate stylesheet file):

#myIframe
{
    position: relative;
    height: 100%;
    width: 100%; 
}

and HTML

<iframe src="https://stackoverflow.com/questions/18765762/./myPage.aspx" id="myIframe" scrolling="no" frameborder="0" > ... </iframe>

mind that scrolling & frameborder are iframe attribute, not style attribute.

Leave a Comment

tech