`background` is the shorthand for all `background-` properties, and so setting it overrides any styles that may have come from a stylesheet.

Since you're only changing the background image here, you can just set that, let the values come from the stylesheet, and remove the line below that re-sets `backgroundSize`:

    document.getElementsByTagName('html')[0].style.backgroundImage = 'url("/img/' + randomImage + '")';