gpt4 book ai didi

css - 在背景上使用多个图像

转载 作者:行者123 更新时间:2023-11-28 18:39:40 24 4
gpt4 key购买 nike

我在网页背景中使用多个图像时遇到问题。我为此使用了以下代码:

body{
background-image: url(images/img1.png), url(images/img2.png); }

我使用的代码在背景上为我提供了两张图片,但我想将其中一张图片恰好放在中心。它如何使用 CSS 做到这一点?

最佳答案

是的,你可以这样做

body {
background-image: url(images/img1.png), url(images/img2.png);
background-repeat: no-repeat, repeat-x;
background-position: center, top left;
}

检查 demo在这里。

关于css - 在背景上使用多个图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11833078/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com