Home  >  Article  >  Web Front-end  >  iframe sets the white background to transparent color in IE browser_HTML/Xhtml_Web page production

iframe sets the white background to transparent color in IE browser_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:37:241684browse

Recently, in the process of working on projects, I need to frequently use iframe to draw the hierarchical frame of the page. Most browsers have no background, but iframe has a white background color by default in IE. When the main background color is not white, It will look very abrupt in this part. The solution given in the help manual is to set the allowTransparent attribute in the iframe to true. Corresponding examples are also given in the help document. The examples are as follows:

Copy the code
The code is as follows:







Theoretically, this should be fine, but IE doesn't seem to respond well. , there is still a white background. In fact, at this step, we still need to add to the tag of the sub-page. The example is as follows:
http://img.blog.csdn.net/20140610165850968?watermark /2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQva3VucGVuZ19tdWJhbw==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center

main.html Main page code:

Copy code
The code is as follows:



< title>


style="width:100%; border:0;height:100%;cellpadding:0;cellspacing:0">









< /body>


test1.html page code:

Copy code
The code is as follows:






test1





test2. HTML page code:

Copy code
The code is as follows:






test2


< /body>


test3.html page code:

Copy code
The code is as follows:






test3





This small example is mainly for iframe tags The allowTransparency attribute is applied. When this attribute is set to true and the background color of the tag of the subpage loaded by the iframe is set to transparent, the iframe will be transparent.

allowTransparency sets or gets whether the object can be transparent.
bgColor sets or gets the background color of the object.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn