Cross Browser Opacity


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /*Making an element transparent can be accomplished using only CSS,
  2. but requires about five lines of code. With jQuery, we can achieve
  3. transparency with just one line: */
  4. $('selector').css('opacity', 0.5);
  5.  
  6. /* below is the CSS way, and it's sloppy
  7. selector {
  8. filter: alpha(opacity=50); /* internet explorer * /
  9. -khtml-opacity: 0.5; /* khtml, old safari * /
  10. -moz-opacity: 0.5; /* mozilla, netscape * /
  11. opacity: 0.5; /* fx, safari, opera * /
  12. }
  13. */

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.