Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.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
Css 如何给两个背景图像没有任何拉伸,但需要重复_Css - Fatal编程技术网

Css 如何给两个背景图像没有任何拉伸,但需要重复

Css 如何给两个背景图像没有任何拉伸,但需要重复,css,Css,以下是我的html代码: <div class="header"> <div class="headerBanner"> <a href="{$websiteUrl}index.html"><img src="img/NewTopBanner.jpg" width="885" height="190" border="0" /></a> </div> </div> 这是我的HTMl

以下是我的html代码:

<div class="header">
   <div class="headerBanner">
        <a href="{$websiteUrl}index.html"><img src="img/NewTopBanner.jpg" width="885" height="190" border="0" /></a>
    </div>
</div>
这是我的HTMl和css代码

它工作,但这两个背景图像延伸到中间。我希望这两个图像(左,右)不拉伸,并重复到页面的中间

#leftHalf {
   background: url(images/bg-1.jpg);
   width: 50%;
   position: absolute;
   left: 0px;
   height: 100%;
}
#rightHalf {
   background: url(images/bg-2.jpg);
   width: 50%;
   position: absolute;
   right: 0px;
   height: 100%;
}
试试这个(未经测试)。这可能对你有帮助

#leftHalf {
   background: url(images/bg-1.jpg);
   width: 50%;
   position: absolute;
   left: 0px;
   height: 100%;
}
#rightHalf {
   background: url(images/bg-2.jpg);
   width: 50%;
   position: absolute;
   right: 0px;
   height: 100%;
}