gpt4 book ai didi

html - body 上的多个背景,使用 CSS

转载 作者:太空宇宙 更新时间:2023-11-03 21:40:33 24 4
gpt4 key购买 nike

我正在尝试为文档 body 设置多个背景。为什么这段代码不起作用?

body
{
background: url(../Images/StandardBackgroundPattern.png) repeat, url(../Images/StandardBackground.png) center center no-repeat;
background-size: auto, cover;
}

此代码仅显示照片。在任何地方都看不到图案(但 Dev Tools 说照片和图案都已加载)。


上面的预期效果是包含一张背景照片,居中并填满视口(viewport)的宽度和高度,并在上面放置一个图案,并在水平和垂直方向上重复它。

如果可能,最好避免为此使用多个 div

最佳答案

这样试试。它应该可以正常工作。

body {
background-image: url(first.png), url(second.png);
background-position: center bottom, left top;
background-repeat: no-repeat;
}

关于html - body 上的多个背景,使用 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23854499/

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