2012-02-07 10 views
5

¿Existe alguna propiedad similar a -webkit-box-reflect para la mozilla y otros navegadores? No pude encontrar en google qué otros navegadores tienen soporte para esto. Entonces, si alguien puede decirme o darme un enlace, eso sería realmente bueno.CSS propiedad box-reflect compatibility?

Respuesta

9

Esto es posible con no solo webkit (último chrome o safari) sino también en el último firefox.

Aquí está el ejemplo: http://codepen.io/jonathan/pen/pgioE

HTML:

<div id="someid"> 
    <img src="image url" /> 
<div/> 

CSS (WebKit):

#someid { 
     /* need some space for the reflection */ 
     margin-bottom: 120px; 
     /* the gradient makes the reflection fade out */ 
     -webkit-box-reflect: below 0px -webkit-linear-gradient(bottom, rgba(255,255,255,0.3) 0%, transparent 40%, transparent 100%); 
} 

CSS (Firefox - Gecko):

#someid { 
     position: relative; 
     /* need some space for the reflection */ 
     margin-bottom: 120px; 
} 

#someid:before { 
     content:""; /* needed or nothing will be shown */ 
     background: -moz-linear-gradient(top, white, white 30%, rgba(255,255,255,0.9) 65%, rgba(255,255,255,0.7)) 0px 0px, -moz-element(#someid) 0px -127px no-repeat; 
     -moz-transform: scaleY(-1); /* flip the image vertically */ 
     position:relative; 
     height:140px; 
     width: 360px; /* should be > image width + margin + shadow */ 
     top: 247px; 
     left:0px; 
} 

Firefox usa -moz-element para hacer las reflexiones (https://developer.mozilla.org/en-US/docs/CSS/element), mientras que webkit usa un prefijo de proveedor propietario para las reflexiones.

Espero que esto ayude!

7

La propiedad -webkit-box-reflect solo es compatible con los navegadores webkit, concretamente Chrome y Safari. Como es una propiedad de webkit patentada, no hay un equivalente para otros navegadores.

La alternativa sería usar javascript para crear un elemento de espejo con opacidad desvanecida.

Cuestiones relacionadas