Previously, we thought that versions earlier than ie9 did not support the opacity attribute. Therefore, the unique filter masks of opacity and IE are used simultaneously. However, sometimes some dynamic effects are required, such as the gradual disappearance and hiding of layers. Dynamic Opacity is required. In this case, it is a little troublesome to use both opacity and filter.
In fact, only opacity + jquery can completely solve this problem.
The usage is as follows:
<script type="text/javascript"> $(function () { $("#p1").css("opacity", 0.6); });</script>
Because JavaScript code cannot be written in the blog, interested friends can directly copy the following sample code to the TXT file,
Change the file suffix to .html, and then run the file directly to view the effect in the browser.
<! Doctype HTML public "-// W3C // dtd xhtml 1.1 // en" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <HTML>
Solution to failure of the opacity attribute in earlier versions of Internet Explorer