CSS for a full page background image

One of the quickest ways to give style to a webpage is to use a full screen image as its background. It can be done with a surprising little bit of CSS. This code will fill the entire background with a centered and scaled image that doesn't cause scrolling and works in all major browsers.

html {  
  background: url("http://i.imgur.com/uO3puXn.jpg") no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

Bret Lowrey

Code is like a war - the best code is one never written.

Florida, USA