我有4张照片和1张div。
每幅图像的大小不同:
img 1 200x400
img 2 600x500
img 3 900x1000
img 4 300x300和div:
<style>
#divimgs{
 height:400px;
 width:800px;
}
</style>
问题是,我如何将这4幅图像作为背景放进#divimgs中,并排并排,每幅图像大小相同=高度400和宽度200 (每幅图像200幅= 800宽-相同的分隔宽度)。
谢谢!
发布于 2015-04-08 14:52:28
这在CSS3中是可能的。你必须使用背景位置,背景大小。
#divimg {
background: url("image1.gif"), url("image2.gif"),url("image3.gif"),url("image4.gif");
background-size: 200px 400px;
background-repeat: no-repeat;
background-position: 0px 0px, 200px 0px, 400px 0px, 600px 0px}查看http://www.w3schools.com/cssref/上的属性
https://stackoverflow.com/questions/29517723
复制相似问题