在IE10中,Iframe不会根据其父级调整其Precentage(%)宽度和高度 [英] In IE10, Iframe does not adjust its Precentage (%) width and height according to its parent

查看:117
本文介绍了在IE10中,Iframe不会根据其父级调整其Precentage(%)宽度和高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有趣的是,我在这个例子中通过制动一个非常小的部分来发现问题。



在IE10中,如果< iframe>在a中存在,以百分比给出的iframe的高度宽度属性并不太注意其父级的高度宽度。



如下例所示,id为''test''的iFrame取高度宽度= 100%。而它的父母的身高是1px。 *当您在IE10中运行时,框架看起来非常大,鞋子出现异常行为*







Interestingly, I have worked this example by braking in it a very small part and found out the problem.

In IE10, if an <iframe> is present inside a , the height width attributes of an Iframe given in percentage doesn''t pay much heed to the height width of its parent.

Like in the following example, iFrame with the id ''test'' takes height width = 100%. While its parent''s height is 1px. *When you run this in IE10, the frame appears to be very large in height and shoes anomolous behavior*



<HTML>
   <HEAD>


   </HEAD>
   <BODY id="WESWinDesktop"  >
   <table id=WESStructure width="100%" height="100%" border="2" cellpadding="0" cellspacing="0">
   <tr>
       <td id="WESMainWinTitleBarCont" height="1px">     this is 'td' for iframe
               <iframe  id="test" src="" frameborder="0" width="100%" height="100%" scrolling="no"></iframe>
       </td>
     </tr>

     <tr>
       <td id="WESMainWinMenuBar" height="20">       menu bar
       </td>
     </tr>
     <tr>
       <td height="100%" >content

       </td>
     </tr>
     <tr>
       <td id="WESMainWinStatus" height="20">    status bar
       </td>
     </tr>
   </table>

   </BODY>
   </HTML>





我尝试了同样的事情放一个



I have tried the same thing by putting a

而不是
,但行为是一样的。所以我猜IE10解释了iframe的宽度高度属性有什么问题。



很多需要帮助的人!



提前谢谢。
instead of a
but the behavior is the same. So I guess there is something wrong IE10 interprets width height attributes of an iframe.

Much Help needed guys!

Thanks in advance.

推荐答案

我还没工作使用IE10,(或IE通常很少),但我之前在各种浏览器之间的代码确实没有什么问题。



对于造型,你下注使用CSS工作表并从那里设计你的Iframe样式然后让浏览器将其排序然后......它让我过来了读取标签中定义的样式属性的浏览器之间的微小差异



例如



I haven''t worked with IE10, (or IE in general very little), but I did have little problems before with codes between various browsers.

For styling, you''re bettor off using a CSS sheet and style your Iframe from there and let the browser sort it out then... It got me over the little differences between the browsers reading style attributes defined in tags

eg

<iframe  id="test" src="" frameborder="0" class="Iframe1" />





和在你的CSS文件中:





and in your CSS file:

background
{
}

.Iframe1
{
    border-style:none;
    width:100%;
    height:100%;
    overflow:none;
}


如果你在html中删除doctype声明,即回退到有这个bug的ie6 / ie7模式。为了纠正这个问题,您需要添加以下元标记。

If you drop a doctype declaration in html, ie falls back to ie6/ie7 mode that had this bug. In order to correct this you need to add the following meta tag.
<meta http-equiv="X-UA-Compatible" content="IE=10" />





您可以使用任何版本或Edge替换10以始终使用最新版本。您的代码在IE10标准模式下运行良好。您可以在F12开发人员工具中更改模式。



You can replace 10 with any version or "Edge" to always use latest version. Your code works fine in IE10 standards mode. you can change the mode in F12 developer tools.


这篇关于在IE10中,Iframe不会根据其父级调整其Precentage(%)宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆