Webpage background image stretching-jerrylsxu provides two solutions:
One is CSS, which uses background-size: cover to achieve image stretching. However, IE8 and earlier versions do not support background-size, so Microsoft filters can be used, however, IE6 does not.
Body {background: url(bg.jpg) center; background-size: cover; height: 900px; width: 100%; filter: progid: weight', sizingMethod = 'Scale ');}
The other is to use jQuery to dynamically insert a p in the body, and then include an image in p. the browser window is changed by an hour and the size of the background image is dynamically set.
$ (Function () {$ ("body"). append (""); $ (" # Main_bg "). append (""); cover (); $ (window ). resize (function () {// cover ();}); function cover () {var win_width = $ (window ). width (); var win_height = $ (window ). height (); $ ("# bigpic "). attr ({width: win_width, height: win_height });}