实际开发中,复合写法更提倡。

    background: 背景颜色 背景图片地址 背景平铺 背景图像滚动 背景图片位置;
    例如:

    1. body {
    2. /* background-color: black;
    3. background-image: url(https://ossweb-img.qq.com/upload/webplat/info/yxzj/20210908/78624200846891.png);
    4. background-repeat: no-repeat;
    5. background-position: center top;
    6. background-attachment: fixed; */
    7. background: black url(https://ossweb-img.qq.com/upload/webplat/info/yxzj/20210908/78624200846891.png) no-repeat fixed center top;
    8. }
    <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>
    

    image.png