CSS图像大小调整

mRt*_*mRt 3 css resize image

我有这个CSS代码:

<style>
     body {
     position:absolute;
     background-image: url(art/c11.jpg);
     width:100%;
     height:100%;
     }
</style>
Run Code Online (Sandbox Code Playgroud)

正如我在网上看到的那样,我希望这会调整背景图像的大小并使其适合浏览器窗口.

但不是.我想我显然做错了(我不太了解CSS).有小费吗?

更新:

我添加了洞的例子(不工作):

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>No Title</title>
<style type="text/css">
     body {
     position:absolute;
     background-image:url(art/c11.jpg);
     background-size:100%;
     background-repeat: no-repeat;
     width:100%;
     height:100%;
     }
</style>
</head>
<body >
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

Con*_*ode 6

添加background-repeat属性.

完成的代码应如下所示:

     body {
     position:absolute;
     background-image: url(art/c11.jpg);
     background-size:100%;
     background-repeat: no-repeat;
     width:100%;
     height:100%;
     }