尝试这个...
#background {
    background: url('image/myimage.jpg') center center;
}
或者
body {
    background: url('image/myimage.jpg') center center;
}
如果您可以在身体级别设置背景,则不需要#background 元素。
但是使用 CSS 设置图像不会缩放图像,“中心中心”将使图像垂直和水平居中。
无论图像大小如何,这都会使其居中。但是,您必须始终提供大于您支持的最大分辨率的图像才能获得您所代表的“过度扫描”样式。
但是,如果您想拉伸背景图像,您可以执行以下操作。它确实需要使用 javascript 和 jQuery 库。
HTML:
<div id="divBackWrapper">
    <div id="divBackCenter">
        <img src="http://www.abc.net.au/radionational/image/4220698-3x2-700x467.jpg" width="700" height="467" />
    </div>
</div>
CSS:
html, body {
    width: 100%; height: 100%;
    padding:0; margin:0;
}
#divBackWrapper, #divBackCenter {
    position: absolute;
    width: 100%; height: 100%;
    overflow: hidden;
}
#divBackCenter {
    overflow: visible;
    top: 50%;
    left: 50%;
}
#divBackWrapper img {
    position: absolute;
    width: 100%; /* change to auto to allow width set by height, one must always be 100% */
    height: auto; /* change to 100% to allow height stretching */
    min-width: 700px;
    min-height: 467px;
    top: -50%; /* half height */
    left: -50%; /* half width */
}
JS:
jQuery(function() {
    $(window).resize(function() {
        var $window = $(window);
        var $img = $("#divBackCenter img");
        if ( $img.width() <= $window.width() ) {
            $("#divBackCenter").removeAttr("style");
            $("#divBackCenter img").removeAttr("style");
            return;
        } else {
            var css = {};
            css.top = -($img.height() - $window.height()) / 2;
            css.left = -($img.width() - $window.width()) / 2;
            $("#divBackCenter").css({top:0,left:0});
            $("#divBackCenter img").css(css);
        }
    });
});