实际开发中,复合写法更提倡。
background: 背景颜色 背景图片地址 背景平铺 背景图像滚动 背景图片位置;
例如:
body {
/* background-color: black;
background-image: url(https://ossweb-img.qq.com/upload/webplat/info/yxzj/20210908/78624200846891.png);
background-repeat: no-repeat;
background-position: center top;
background-attachment: fixed; */
background: black url(https://ossweb-img.qq.com/upload/webplat/info/yxzj/20210908/78624200846891.png) no-repeat fixed center top;
}
<body>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
<p>nihao</p>
</body>