0

我有一个看起来像这样的背景:

在此处输入图像描述

如您所见,它没有完全拉伸。所以我希望它涵盖所有内容。

body {
    background-image: url("/site_media/resume/images/bg_main.jpg");
    background-color: #c7c7c7;
    background-repeat: repeat-x;
    font: 12px/20px;
    font-family: "lucida Sans Unicode" "Lucida Grande" sans-serif;
}

如果我做

background-size: 100%;

我到处都是深绿色。

4

1 回答 1

2

try to use

background-size: cover; 

See MDN documentation

[...] cover, which specifies that the background image should be scaled to be as small as possible while ensuring both its dimensions are greater than or equal to the corresponding dimensions of the background positioning area.

于 2012-09-17T16:22:54.397 回答