【问题标题】:Iframe's overflow problemiframe的溢出问题
【发布时间】:2011-03-29 12:23:53
【问题描述】:

我有一个包含 iframe 的简单页面。 iframe 包含一个带有一些 div 的页面。当我单独打开嵌入页面时,它工作得很好。应该溢出的 div 溢出了。但是当我打开容器站点时,它不是。这是我的代码:

容器页面:

<!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>

可嵌入页面:

<!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 应该被溢出,但事实并非如此。我已将所有重要的 div 的“溢出”属性设置为“可见”(即使它是默认值)。我不知道我做错了什么。

【问题讨论】:

    标签: css iframe overflow


    【解决方案1】:

    简而言之,iframe 不可能溢出。 This post给出解释。

    为了达到你想要的效果,你最好使用AJAX将嵌入页面注入到一个div中,并使div溢出。

    【讨论】:

      猜你喜欢
      • 2016-09-08
      • 1970-01-01
      • 2011-04-14
      • 2022-11-10
      • 2011-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多