Well, there are at least two ways to achieve this result. You can pick one of them depending on browsers compatibility.
1) You can choose a pure-css solution using a background image for your div and setting:
background-size: cover;
You cannot use this approach if IE8 is one of your target browsers.
2) You can use a javascript library. I often use a library called jquery Backstretch. It’s very easy to use.
solved Can anyone tell me how this effect is achieved? [closed]