X-browser CSS fake reflection (IE9+)
Since only WebKit knows about box-reflect-property we can only trick the eye into seeing a reflection for other browsers.
by Schepp
HTML
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
<div class="reflection">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.</div>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
CSS
p {
margin: 1em 0;
padding: 0 20px;
}
.reflection {
position: relative;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 400px;
padding: 20px;
background-color: #000;
color: #CCC;
border-radius: 8px;
/* opacity of the reflection: 0.7, height of the reflection: 70px */
-webkit-box-reflect: below 1px -webkit-linear-gradient(bottom, rgba(255,255,255,0.7), transparent 70px);
}
.reflection:after {
position: absolute;
z-index: -1;
left: 0;
bottom: -71px;
display: block;
content: "";
width: 100%;
/* height of the reflection */
height: 70px;
/* opacity of the reflection: 0.7 */
opacity: 0.7;
/* Fade to transparent
inset 0 [height - 10px] [height - 10px] [height * -0.5] #000;
*/
-moz-box-shadow: inset 0 60px 60px -35px #000;
box-shadow: inset 0 60px 60px -35px #000;
/* Needs to come after the non-prefixed version in order to override it, since we have -webkit-box-reflect already */
-webkit-box-shadow: none;
/* No borders at the bottom */
border-radius: 8px 8px 0 0;
}