We know that IE6 does not support transparent PNG, which undoubtedly limits the space for webpage design.
However, the entire Internet solution to this IE6 transparent PNG solution is also numerous, from the use of IE-specific filters or expressions, and then to JavaScript + transparent GIF alternative. However, these methods haveDisadvantagesThat is, CSS is not supported.Backgrond-PositionAndBackground-repeat.
I will introduce dd_belatedpng today, justOne reasonThat is, it supportsBackgrond-PositionAndBackground-repeat. This is not available for other JS plug-ins. At the same time, dd_belatedpng also supports the: hover attribute and .
View demo
Principle
This JS plug-in uses Microsoft's VML language for rendering, while most other JS plug-ins that solve PNG problems use the alphaimageloader filter.
Usage
1. Download The dd_belatedpng.js file here.
2. Reference in the webpage as follows:
<! -- [If lte ie 6]>
<SCRIPT src = "JS/dd_belatedpng_0.0.8a.js" type = "text/JavaScript"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
Dd_belatedpng.fix ('div, UL, IMG, Li, input, A,. png_bg ');
/* Change. png_bg to the CSS selector with transparent PNG applied */
</SCRIPT>
<! [Endif] -->
3. There are two types of calling functions. One is dd_belatedpng.fix (), as shown in the code above. The other is fix (). In this method, the CSS selector name must be specified in the function.
Use a: hover
5-25 update:If you want to use transparent PNG as the background image of a: hover like jutoy, you need to pay attention to your code,Use "A: hover" as the selector.Otherwise, the operation may fail. At the same time, I have updated the demo. Please check the required updates. Then let's take a look.CorrectCode:
<!--[if IE 6]>
<script type="text/javascript" src="js/DD_belatedPNG.js" ></script>
<script type="text/javascript">
DD_belatedPNG.fix('.trans,.box a:hover');
</script>
<![endif]-->
Other solutionsOther solutions are provided here for your reference.
- Unit PNG fix
- Ie7-js
- Ie png fix