Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 外面的重复图像_Html_Css - Fatal编程技术网

Html 外面的重复图像

Html 外面的重复图像,html,css,Html,Css,我正在处理一个网页,我有以下CSS: body { background: url('../images/numbers.png'); font-family: Arial, Helvetica, sans-serif; font-size: 14px; width: 1024px; height: 900px; } 以及以下HTML: <!DOCTYPE html> <html> <head> <me

我正在处理一个网页,我有以下CSS:

body {
    background: url('../images/numbers.png');
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    width: 1024px;
    height: 900px;
}
以及以下HTML:

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Index</title>
    <link rel="stylesheet" href="css/common.css">
</head>

<body>

</body>

</html>

指数
我已经为body设置了一个尺寸(1024x900),但我在浏览器上看到了那个页面,到处都是numbers.png(我的显示器分辨率比那个大)

如何仅在身体内部设置背景图像(定义为1024x900)? Web浏览器中间的中心体如何?


顺便说一句,image numbers.png比1024x900小。

使用这个:

body {
background: url('../images/numbers.png') no-repeat center center;
display:block;
width: 1024px;
height: 900px;
margin:0 auto;
}
使用以下命令:

body {
background: url('../images/numbers.png') no-repeat center center;
display:block;
width: 1024px;
height: 900px;
margin:0 auto;
}

添加
背景重复:不重复


并使用:
margin:0px auto对车身进行定心

添加
背景重复:无重复


并使用:
margin:0px auto对车身进行定心

最简单的方法是创建页面包装:

<body>
  <div id="page"></div>
</body>

这是一种常见的方法,如果您以后使用viewport进行操作(例如100%高度),将省去很多麻烦。

最简单的方法是创建页面包装器:

<body>
  <div id="page"></div>
</body>

这是一种常见的方法,如果您以后使用viewport进行操作,例如100%高度,这将避免麻烦。

正文就是您在页面中看到的所有内容“包括左右两侧的空白”

你需要有一个这样的容器div

      body {
        font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    }
    #container {
        background: url('../images/numbers.png');
        width: 1024px;
        height: 900px;
        margin: 0 auto;
    }

    <!DOCTYPE html>
    <html>

    <head>
        <meta charset="utf-8">
        <title>Index</title>
        <link rel="stylesheet" href="css/common.css">
    </head>
    <body>

    <div id="container" >
    <!-----page content goes here----->
    </div>

    </body>
    </html>
正文{
字体系列:Arial、Helvetica、无衬线字体;
字体大小:14px;
}
#容器{
背景:url('../images/numbers.png');
宽度:1024px;
高度:900px;
保证金:0自动;
}
指数

正文是您在页面中看到的所有内容“包括左右两侧的空白”

你需要有一个这样的容器div

      body {
        font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    }
    #container {
        background: url('../images/numbers.png');
        width: 1024px;
        height: 900px;
        margin: 0 auto;
    }

    <!DOCTYPE html>
    <html>

    <head>
        <meta charset="utf-8">
        <title>Index</title>
        <link rel="stylesheet" href="css/common.css">
    </head>
    <body>

    <div id="container" >
    <!-----page content goes here----->
    </div>

    </body>
    </html>
正文{
字体系列:Arial、Helvetica、无衬线字体;
字体大小:14px;
}
#容器{
背景:url('../images/numbers.png');
宽度:1024px;
高度:900px;
保证金:0自动;
}
指数

顺便说一下,image numbers.png比1024x900小。对不起,我忘了说。顺便说一下,image numbers.png比1024x900小。对不起,我忘了说。我会给你+1,但你4分钟后才重复我的答案:)我会给你+1,但你4分钟后才重复我的答案:)