Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Iframe's overflow problem

I have a simple page that contains an iframe. The iframe contains a page with some divs. When I open the embedded page separetely it works very well. The div that should be overflowed is overflowed. But when I open the container site it is not. Here are my codes:

Container page:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>

    <style type="text/css">
            #content{
                margin: auto;
                width: 500px;
                height: 1000px;
                background: green;
            }

            #frame{
                width:202px; 
                height:302px; 
                overflow: visible;
            }
    </style>

  </head>

  <body>
        <div id="content">
            <iframe id="frame"
                src="http://localhost:8080/webApp/view/test/embeddable.html" 
                scrolling="no" frameborder="0" allowTransparency="true" marginheight="0" marginwidth="0">
            </iframe>           
        </div>
  </body>
</html>

Embeddable page:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
  <head>
    <style type="text/css">
        body {
            width: 200px;
            height: 300px;
            overflow: visible;
            border: 1px solid yellow;
        }

            #id1{
                margin: auto;
                width: 500px;
                height: 10px;
                border: 1px solid white;
                background: red;
                margin-top: 20px;
            }
    </style> 
  </head>

  <body>
        <div id="id1"></div>        
  </body>
</html>

id1 should be overflowed but it isn't. I have set all the important div's "overflow" property to "visible" (even if it is the default). I don't know what I'm doing wrong.

like image 267
Pinki Avatar asked Aug 13 '10 14:08

Pinki


1 Answers

In short, it is not possible to have an overflowed iframe. This post gives an explanation.

To achieve the similar effect you're after, you're better off use AJAX to inject the embedded page into a div, and make the div overflow.

like image 113
William Niu Avatar answered Oct 13 '22 01:10

William Niu