Css ie filter png image incompatible with ie6/ie7/ie8 solution

Source: Internet
Author: User

First, we select a png image with a translucent dot. The background color of the page is #660. Observe the performance of ie6/7/8. Because ie6 does not support translucent points, it turns gray.

<Style>
Body {background: #660}

Div
{
Position: absolute;
Filter: alpha (opacity = 20 );
Width: 256px;
Height: 256px;
}

Img
{
Position: absolute;
}
</Style>
<Div>

</Div>

This time, ie8 encountered a strange phenomenon: the img element was not applied to the filter! The reason is that it sets position: absolute. If you delete this sentence, it will be the same as ie7. It can be seen that ie8 also has a bug: the filter will not be applied to the absolute positioning child element! However, when <meta http-equiv = "x-ua-compatible" content = "ie = emulateie7"/> is added, the compatibility mode is okay.

<Style>
Body {background: #660}

. Out
{
Filter: alpha (opacity = 20 );
Width: 256px;
Height: 256px;
}

. In
{
Filter: progid: dximagetransform.microsoft.alphaimageloader(src+'alpha.png ');
Width: 256px;
Height: 256px;
}
</Style>
<Div class = "out">
<Div class = "in"> </div>
</Div>

After some tests, div nested img still does not work. We may wish to use div nested div without loading the image using background. If you have a good memory, you should know that ie has an alphaimageloader filter. Let's try to use it to load png: this is the right time! Not only does ie7 and ie8 correctly show that our ancestor IE6. Success!

 

Related Article

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.