Nov 23



Imagen 3-1Bueno, dicho lo malo que es Internet Explorer, esta es una solución para todos los que le han recordado su mamá a los desarrolladores del IE 6 por no soportar la transparencia en archivos PNG (el IE7 ya tiene ese soporte). Este truco es aplicable a las imágenes que se cargan a través de una hoja de estilos (CSS). Sólo necesitan agregar éste código a su hoja de estilos:

* html img,

* html .png{

behavior: expression((this.runtimeStyle.behavior=”none”)&&(this.pngSet?this.pngSet=true:(this.nodeName == “IMG” && this.src.toLowerCase().indexOf(‘.png’)>-1?(this.runtimeStyle.backgroundImage = “none”,

this.runtimeStyle.filter = “progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’” + this.src + “‘, sizingMethod=’image’)”,

this.src = “transparent.gif”):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace(‘url(“‘,”).replace(‘”)’,”),

this.runtimeStyle.filter = “progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’” + this.origBg + “‘, sizingMethod=’crop’)”,

this.runtimeStyle.backgroundImage = “none”)),this.pngSet=true)

);

}

Por supuesto que esto no es un código válido, pero si funciona :D y no es tan lento, así que lo pueden usar para todas las imágenes de su sitio.

Enlace | CSS Png Fix for IE
Visto en webAdictos

Comparte este post:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Bitacoras.com
  • Live
  • Meneame
  • Technorati
  • TwitThis
  • Wikio
  • StumbleUpon
  • Tumblr
Suscríbete al feed

2 Comentarios en “PNG transparentes en IE con CSS”

  1. elPive Escribió:

    este codigo a mi no me funciona, lo he pegado tal cual y no hace absolutamente nada, no se si hay que quitarle algo al codigo, ya sea comillas o lo que sea

  2. Luis Escribió:

    PERO ESO ES JAVASCRIPT!! DENTRO DE CSS? NO CROE QUE FUNCIONE TANSOLO POR VALIDACION.

    SALUDOS!