There are two ways to resolve this:
One is CSS, using background-size:cover to achieve the image stretching effect, but IE8 and the following version does not support Background-size, so you can use the Microsoft filter effect, but IE6 does not support.
Body {background:URL (bg.jpg) center Center; background-size:cover; height:900px; width:100%; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (src= ' bg.jpg ', sizingmethod= ' scale ')
The other is to use jquery to dynamically insert a div in the body, and then include a picture in the Div, and the size of the background image is dynamically set when the browser window is resized.
$(function(){ $("Body"). Append ("<div id= ' main_bg ' style=" Position:absolute; " /> "); $("#main_bg"). Append ("); Cover (); $ (window). Resize (function(){//browser window Changescover (); }); }); functioncover () {varWin_width =$ (window). width (); varWin_height =$ (window). Height (); $("#bigpic"). attr ({width:win_width,height:win_height}); }