2012-09-13 107 views
18

我在里面创建了一个iframe对话框,问题是边框不断在IE8中显示,这在任何其他浏览器中都能很好地工作。如何摆脱IE8 iframe的边框

这是我已经尽力了,我也试过边界:无

$(d.dialog).find('#MyCoolDialogInner').html('<iframe src="/apex/EscalationForm?id={!Case.Id}" height="495" width="380" marginheight="0" marginwidth="0" frameborder="0"/>'); 

在此先感谢

+0

没有ü尝试使用'css'? –

回答

47

添加FRAMEBORDER属性(注意是大写的“B”)。

因此,它看起来像:

<iframe frameBorder="0">Browser not compatible.</iframe> 
+1

(注意大写'B')谢谢!!!!完善。 – FlemGrem

+0

只是想知道:有没有*任何*浏览器版本'B'的情况很重要? (我怀疑它。) – ACJ

+0

在我的情况下,从IE浏览器dom explorer(用于调试目的)添加属性frameBorder没有任何影响。我不得不改变html文件本身并刷新浏览器中的页面。 –

4

您是否尝试过通过CSS设置呢?

iframe { 
    border:0px none transparent !important; 
} 

此外,这些似乎也工作 - marginheight="0" marginwidth="0" frameborder="0"。取自this post on the same IE issue

2

试试这个:

<iframe frameborder="no" /> 
0

frameborder可以是10,不知道 “不” 是一个有效的值。 Coda在编码时提供有效的值选项,当我对iframe执行此操作时,只有1和0可用。

1

我意识到IE8对于iFRAMES来说是个讨厌的东西。 “FrameBarder”在HTML5中被弃用,所以虽然它是IE8最简单的选项,但这不是一个长期的解决方案。

通过将iFRAME放置在容器中,我已成功隐藏边框和滚动条。 iFRAME容器本身放置在div的内部,以便在网页上进行全面定位。 iFRAME本身是绝对定位的,并且为了隐藏顶部和左侧边界而应用于顶部和左侧的负边距。绝对定位的iFRAME的宽度和高度应该超过100%编码,因此超过了父级大小,直到右边界和下边界不可见(也不可见滚动条)。此技术也使iFrame响应,因为iFRAME容器使用百分比以及容纳容器的div。当然,iFRAME父div必须设置为overflow:hidden。

下面是一个例子代码:

/*THE PARENT DIV FOR THE iFRAME CONTAINER*/ 
    .calcontainer 
     { 
     width:100%; /*adjust iFrame shrinking here - if floating use percentage until no white space around image.*/ 
     max-width:200px;  
     margin:auto;  
     } 


    /*THE RELATIVE POSITIONED CONTAINER FOR THE iFRAME*/ 

    .calinside /*container for iFRAME - contents will size huge if the container is not contained and sized*/ 
     { 
     position:relative; /*causes this to be the parent for the absolute iFRAME*/ 
     padding-bottom: 100%; /* This is the aspect ratio width to height ratio*/ 
     height: 0; 
     overflow:hidden; /*hides the parts of the iFRAME that overflow due to negative margins and over 100% sizing*/  
     } 


/*THE ABSOLUTE POSITIONED iFRAME contents WITH NEGATIVE MARGINS AND OVER 100% SIZE IS CODED HERE. SEE THE NORMAL SETTINGS VERSUS THE IE8 SETTINGS AS MARKED. A SEPARATE CSS FILE IS NEEDED FOR IE8 WITH A CONDITIONAL STATEMENT IN THE HEAD OF YOUR HTML DOCUMENT/WEB PAGE*/ 

    .calinside iframe 
     { 
     position: absolute; 
     top: 0; 
     left: 0; 
     width: 100% !important;/*must expand to hide white space to the right and below. Hidden overflow by parent above*/ 
     height: 103% !important; /*must expand to hide white space to the right and below. Hidden overflow by parent above*/ 
     /*IE8*/top: -2%; 
     /*IE8*/left: -2%; 
     /*IE8*/width: 114% !important;/*For IE8 hides right border and scroll bar area that is white*/ 
     /*IE8*/height: 105% !important; /*hide white space and border below. Hidden overflow by parent above*/   
     } 
+0

欢迎来到Stack Overflow!最好预览你的文章,以确保格式化。 –