javascript - Page background doesn't display whole image -
i have website background image, choosen random javascript:
document.body.style.background= 'url('+randombgs[num]+')';
i have set background imagefrom randombgs[]
array contains 15 backgrounds. background gets cut off, , whole image isn't displayed (see picture below)
how can fix this, browser shows whole image , not 95% of it?
use css background-size property:
body { background-size: contain; }
the image fit container.
Comments
Post a Comment