An iframe background transparent setting method _ Basic Tutorial

Source: Internet
Author: User

IE5.5 begins to support transparent content of floating frames. If you want to define transparent content for a floating frame, the following conditions must be met.
1. The Allowtransparency Label property used with the IFRAME element must be set to true.
2. In the iframe content source document, the bgcolor label property of the Background-color or BODY element must be set to transparent

Copy Code code as follows:

<iframe src= "./ads_top_tian.html" allowtransparency= "true" style= "background-color=transparent" title= "test" Frameborder= "0" width= "470" height= "308" scrolling= "no" ></iframe>

Of course, the premise is that there is no color set in the IFRAME page.
In the above we mainly see the style of a code style= "Background-color=transparent" through the following four kinds of iframe writing I think maybe you should have a clear understanding of the implementation of the IFRAME background transparency effect:
Copy Code code as follows:

<iframe id= "Frame1" src= "transparentbody.htm" allowtransparency= "true" ></IFRAME>
<iframe id= "Frame2" src= "transparentbody.htm" allowtransparency= "true" style= "Background-color:green" > </ Iframe>
<iframe id= "Frame3" src= "transparentbody.htm" ></IFRAME>
<iframe id= "Frame4" src= "transparentbody.htm" style= "Background-color:green" > </IFRAME>

Now let's look at an example
This example is primarily an Allowtransparency property application of an IFrame object that is transparent when the property is set to True and the background color of the page on the IFRAME is set to transparent (transparent).
Allowtransparency Sets or gets whether the object can be transparent.
bgcolor Sets or gets the background color of an object

Parent page

Copy Code code as follows:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Parent Page </title>
<body bgcolor= "#FF0000" >
<iframe src= "index.htm" allowtransparency= "true" ></iframe>
</body>

Child pages

Copy Code code as follows:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Sub-page </title>
<style type= "Text/css" >
Body
{
Background-color:transparent;
}
</style>
<body>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.