How to use DD_belatedPNG to make IE6 support PNG transparent images?
Use DD_belatedPNG to make IE6 support PNG transparent images
Recommended learning: 梦Weavercms
As we all know, IE6 does not support transparent PNG images. In terms of expressiveness in Web design, PNG images have effects that other graphic formats cannot achieve. This fatal flaw of IE6 greatly limits the creative expression of Web design.
Although there are many ways to solve the problem of transparent PNG in IE6, from using IE-specific filters or e-xpression to javascript transparent GIF replacement. However, these methods have a disadvantage, that is, they do not support CSS. background-position and background-repeat attributes.
The use of DD_belatedPNG.js can perfectly solve the problem of PNG image transparency under IE6, and supports background-position and background-repeat. This is not available in other methods. At the same time, DD_belatedPNG also supports the a:hover attribute. and .
Our website has added DD_belatedPNG to process navigation PNG transparent images so that it maintains the same appearance under different browsers.
Usage:
First download the JS file
http://www.028guzheng.com/793395_16370305896/DD_belatedPNG_0.0.8a.js
and then quote the code on the page:
<!--[if IE 6]> <script type="text/javascript" src="js/DD_belatedPNG_0.0.8a-min.js"></script> <script> DD_belatedPNG.fix('css选择器,应用类型'); </script> <![endif]-->
The reference function is DD_belatedPNG.fix(), brackets Fill in the CSS selector for applying PNG (ID selector and class selector can be used) and application type (divided into img and background).
Such as DD_belatedPNG.fix(‘#box-one, img’) or DD_belatedPNG.fix(‘.header, background’) etc.
These can be abbreviated as DD_belatedPNG.fix(‘#box-one, .header, img,background’); .
More selectors such as DD_belatedPNG.fix(‘#box-one, .header,#footer,.box-two a:hover, img,background’); etc.
In addition, in order to solve the problem of background image flickering under IE6, you can add the following script to the page
<!–-[if IE 6]> <script type=”text/javascript”> // <![CDATA[ if((window.navigator.appName.toUpperCase().indexOf("MICROSOFT")>=0)&&(document.execCommand)) try{ document.execCommand("BackgroundImageCache", false, true); } catch(e){} // ]]> </script> <![endif]–->
The above is the detailed content of How to use DD_belatedPNG to make IE6 support PNG transparent images. For more information, please follow other related articles on the PHP Chinese website!