如何在IE8中摆脱Iframe的边框



我正在创建一个内部带有 iframe 的对话框,问题是边框在 IE8 中不断显示,这在任何其他浏览器中都能完美运行。

这是我尝试过的,我也尝试过边界:无

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

提前致谢

添加 frameBorder 属性(注意大写字母"B")。

所以它看起来像:

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

您是否尝试过通过CSS进行设置?

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

此外,这些似乎也有效 - marginheight="0" marginwidth="0" frameborder="0".取自这篇文章关于同一IE问题。

试试这个:

<iframe frameborder="no" />

我意识到IE8在iFRAMES方面很麻烦。 "Frameborder"在HTML5中被弃用,所以虽然它是IE8最简单的选择,但这不是一个长期的解决方案。

我通过将 iFRAME 放置在容器内成功地隐藏了边框和滚动条。 iFRAME 容器本身放置在div 内,以便在网页上进行整体定位。 iFRAME 本身是绝对定位的,并且对顶部和左侧都应用负边距,以隐藏顶部和左侧边框。绝对定位的 iFRAME 的宽度和高度应编码为 100% 以上,使其超出父大小,以至于右侧和底部边框不可见(滚动条也不可见)。 此技术还使 iFrame 响应,因为 iFRAME 容器使用百分比以及保存容器的div。 当然,iFRAME 父div 必须设置为溢出:隐藏。

下面是一个示例代码:

    /*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*/          
        }

frameborder可以是10,不确定"no"是否有效。Coda 在编码时提供了有效的值选项,当我对我的 iframe 执行此操作时,只有 1 和 0 可用。

最新更新