Css 在类似div和图像的网格中排列固定附件的背景图像

Css 在类似div和图像的网格中排列固定附件的背景图像,css,background,background-image,fixed,parallax,Css,Background,Background Image,Fixed,Parallax,小提琴没有正确地渲染精确的网格,但它让你知道我要做什么。每个div都有一个固定的背景图像。问题是,即使尝试使用“背景位置”重新定位图像,每个背景图像都默认位于左上角 样式看起来像这样 #thumb1{ background-size: cover; background-position: center; background: url("../img/gal1.png"); background-attachment: fixed; background-repeat: n

小提琴没有正确地渲染精确的网格,但它让你知道我要做什么。每个div都有一个固定的背景图像。问题是,即使尝试使用“背景位置”重新定位图像,每个背景图像都默认位于左上角

样式看起来像这样

#thumb1{
 background-size: cover;    
 background-position: center;
 background: url("../img/gal1.png");
 background-attachment: fixed;
 background-repeat: no-repeat;
}

.gallerythumb {
 color: white;
 position: static;
 float: left;
 width: 33.333vw;
 height: 100vh;
}
还有你想象中的html

<div class="gallerythumb" id="thumb2">1</div>
1

我尝试将Size属性设置为container,但效果不大。有人知道如何在div中居中放置背景图像吗

你能详细说明一下吗。如果我正确阅读您的评论,您希望每个图像都以**id=“thumb*”**div.@govind为中心是的。每个背景图像将在其固定的div内居中。