问题描述
在我网站的右侧,我有视差滚动图像,因此我试图重新定位.image-greet元素,以便当您位于网站顶部时,玫瑰底部{{3} }居中并填充了窗格。
当前,仅显示图像砖墙的顶部。我在修改背景位置以使其在图像上移动时遇到困难。
我尝试使用背景位置,背景位置x,背景位置y和变化的偏移量的不同变体,但我一直在努力使其正确。
.image-greet,.image-greet.load {
grid-column: images;
background: url("https://i.imgur.com/aBaG1o8.jpg");
margin: 6% auto;
width: 75%;
background-repeat: no-repeat;
background-color: white;
background-attachment: fixed;
height: 55%;
background-size: 40% auto;
background-position: 90% 20%;
}
感谢所有帮助!
解决方法
我通过以下资源找到了答案:https://css-tricks.com/positioning-offset-background-images/
“”如果您需要在CSS中将背景图像从左侧放置20px,从顶部放置10px,则很容易。您可以将background-position设置为:20px 10px;。但是如果要将其放置在距CSS 20px的位置,该怎么办?右下方10像素?”
所以我应用了它并做了
背景位置:右侧25像素底部250像素;