Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Where the Technology is redefined!

Administrators

Gandhinagar Institute of Technology

Using Reflection of images in CSS3

Nov 9 2011 11:15AM by Vivek Doshi   

If some where is required to use reflection for achieving cool backgrounds, the designer had to use couples of images with loads of positioning and opacity stuff, but with CSS3 this can be done easily

As show in the image below the reflection achieved with just a small css code.

alt text

The reflection use the box property of CSS3

Use this code to achieve the reflection

The CSS code:

#imgmask
{
    -webkit-box-reflect:below 4px -webkit-gradient(linear,left top , left bottom, from(transparent), to(rgba(255,255,255,.5)));
    -moz-box-reflect:below 4px -webkit-gradient(linear,left top , left bottom, from(transparent), to(rgba(255,255,255,.5)));
     -ie-box-reflect:below 4px -webkit-gradient(linear,left top , left bottom, from(transparent), to(rgba(255,255,255,.5)));
     -o-box-reflect:below 4px -webkit-gradient(linear,left top , left bottom, from(transparent), to(rgba(255,255,255,.5)));
}

The HTML code:

<div id="imgmask">
<img src="imgs/Vivek Doshi.jpg" height="200" width="200" />
</div>

The -webkit and other specific the vendor prefix for using the property as each implements this differently. The webkit browser (Chrome and Safari) support fully others implements it partly.

For demo visit:http://iamvivekdoshi.co.cc/mask.html

Tags: CSS 3


Vivek Doshi
306 · 0% · 141
2



Submit

3  Comments  

  • Very interesting

    commented on Nov 9 2011 11:42AM
    Jacob Sebastian
    1 · 100% · 32004
  • Nice post, how to have the reflection for a dynamically loading images? We can use the same concept?

    commented on Nov 16 2011 10:58PM
    Karthikeyan Anbarasan
    53 · 4% · 1151
  • @karthikeyan ... If you want reflect is it dynamically use this.class Name in any event and put the reflections (hover class) name in that.

    commented on Nov 17 2011 9:12AM
    Vivek Doshi
    306 · 0% · 141

Your Comment


Sign Up or Login to post a comment.

"Using Reflection of images in CSS3" rated 5 out of 5 by 2 readers
Using Reflection of images in CSS3 , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]