Skip to content

Instantly share code, notes, and snippets.

@santosh
Created January 3, 2013 05:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santosh/4440993 to your computer and use it in GitHub Desktop.
Save santosh/4440993 to your computer and use it in GitHub Desktop.
CSS: CSS technique to make image reflectionss
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" media="screen" href="reflection.css" />
<title> Image Reflection </title>
</head>
<body>
<img src="http://davidwalsh.name/demo/ricci-url.jpg" alt="CSS Image Reflection - Safari" width="300" class="reflectBelow" />
</body>
</html>
body {
text-align: center;
}
.reflectBelow {
-webkit-box-reflect:below 0px
-webkit-gradient(linear, left top, left bottom, from(transparent),
color-stop(0.5, transparent), to(white));
}
.reflectAbove {
-webkit-box-reflect:above 20px
-webkit-gradient(linear, left top, left bottom, from(transparent),
color-stop(0.5, transparent), to(white));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment