CSS Body Wallpaper

Posted on Monday May 2nd, 2016

One of the frustrations I have had for a while has been the desire to correctly place a CSS wallpaper on the body of a webpage - but ensuring it correctly scales both horizontally and vertically dependant upon the size of the browser window. Today I got it:

body {
    background: url("wp.jpg") no-repeat center center fixed;
    background-position: center top;
    background-size: cover;

Credit where credit is due : https://css-tricks.com/perfect-full-page-background-image/.