The CSS Parallax Effect is something that is rarely used in web design but is really cool when used properly. This CSS technique utilizes absolute positioning, percentage background positioning, and z-index to create a realistic 3d scrolling background. Before we get started, let me just warn you that this effect is likely to only be effective in every browser except for Internet Explorer 6 (and lower). Since we are relying heavily on transparent .png images and absolute positioning, it's wise not to even bother to try and hack your way through.
Before we get started on a quick tutorial of how to achieve this effect, here are a few examples of the Parallax Effect in it's finest. (Note: To see the effect, resize your browser window horizontally.)
Example #1 - Dumago.net
Example #2 - Dromaeo.com
Example #3 - Sitepoint.com
It's cool, isn't it? It's very simple to achieve with only two or three absolutely-positioned divs. Here's how to make a quick example.
This will be our HTML:
<body> <div id="middle-bg"></div> <div id="front-bg"></div> </body>
Here is our CSS:
body { background: url(images/back-bg.png) repeat 5% 5%; } #middle-bg { z-index: 997; background: url(images/middle-bg.png) repeat 20% 70%; position: absolute; top: 0; left: 0; right: 0; bottom: 0; } #front-bg { z-index: 998; background: url(images/front-bg.png) repeat 200% 110%; position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
That's all. You've successfully created a simple Parallax Effect in CSS. That wasn't so hard, was it?
One small detail. Since these backgrounds have a high z-index and are positioned absolutely, to have any content on top of them you'd need to make sure the containing div had a higher z-index and was also positioned absolutely.
See my example: Demo
Download my example: Download
You have to admit, this is a pretty nifty effect that I had previously never heard of before. I was enlightened about this by ViciousDuck over a chat we were having last night. Credit goes to CSS-Tricks for the original article I read to get informed on this subject.
If you liked this post, stay updated. Follow me on Twitter or subscribe to our RSS Feed via email.

















Thanks for the credz...
Overall, a pretty cool post. I already knew about it, so I didn't gain anything from reading it, but whatever..
ViciousDuck´s last blog post: How to Theme Your iPod.