Solution to the problem that the PNG Image background in IE7 or earlier browsers is not transparent and the link is invalid

Source: Internet
Author: User
Tags transparent image

Transparent Image Processing

 

<! -- [If lt IE 7]>
<Style type = "text/CSS">
Div, IMG {behavior: URL (iepngfix. HTC )}
</Style>
<! [Endif] -->
<Style>
Body {Background: URL (/bg.jpg )}
. Iepng {width: 275px; Height: 94px; Background: URL (/home.png); padding: 20px ;}
</Style>
<Body>
<Div class = "iepng"> test <br/>
<Br/>
<A href = "#"> transparent images </a> </div>
</Body>
Now, test IE6 and you will find that the PNG background is transparent. However, sometimes we need to implement this effect on the located layer. For example, if the effect of this example is fixed on another layer, similar to the pop-up window, we need to use position: absolute; float this layer. Then the problem occurs again, and the link becomes invalid ???

<! -- [If lt IE 7]>
<Style type = "text/CSS">
Div, IMG {behavior: URL (iepngfix. HTC )}
</Style>
<! [Endif] -->
<Style>
Body {Background: URL (/bg.jpg )}
. Iepng {position: absolute; top: 261px; left: 309px; width: 275px; Height: 94px; Background: URL (/home.png); padding: 20px ;}
</Style>

<Body>
<Div class = "iepng"> test <br/>
<Br/>
<A href = "#"> test text </a> </div>
</Body>

Previously, I also saw the method provided by others. I defined a relative property position: relative; for the link, but I tried it. Is there any other way to achieve this? Below I will provide a stupid way to achieve it:
Since it is a floating layer with an absolute position, we use two floating layers with an absolute position to separately set the background on a layer and place this layer down, is this method feasible to put text and link content on the top layer ?? Practice is the only criterion for testing truth. Let's wait and see !!

<! -- [If lt IE 7]>
<Style type = "text/CSS">
Div, IMG {behavior: URL (iepngfix. HTC )}
</Style>
<! [Endif] -->
<Style>
Body {Background: URL (/bg.jpg )}
. Iepng {position: absolute; top: 261px; left: 309px; width: 315px; Height: 134px; Background: URL (/home.png); Z-index: 1 ;}
. Iepng1 {position: absolute; top: 261px; left: 309px; width: 275px; Height: 94px; padding: 20px; Z-index: 2 ;}
</Style>

<Body>
<Div class = "iepng1"> test <br/>
<Br/>
<A href = "#"> test text </a> </div>
<Div class = "iepng"> </div>
</Body>
Haha, the problem is solved! Use Background: URL (/home.png )! Important; Background: none; filterrogidximagetransform. microsoft. alphaimageloader (Enabled = "true", sizingmethod = "image", src = "/home.png") to make the background transparent, when using position: absolute; link failure can also be solved through double-layer overlap during locating.

 

 

 

 

Source http://www.aa25.cn/368.shtml

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.