How do I create a parallax effect?

css
#1

How to create a parallax?

#2

Here is a pure CSS solution
Pure-CSS Parallax Scrolling Effect
CodePen demo

JavaScript can make this much more concise.

Here is a jQuery plugin that makes it simple
Simple Parallax Scrolling
documentation

and here is a more robust solution
parallax.js
documentation