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)

this see:
this see

this should see
this should see

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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -