Multiple Backgrounds on Body

前端 未结 2 1290
伪装坚强ぢ
伪装坚强ぢ 2020-12-22 03:19

Not sure if this is possible but can i put one transparent image over the standard background image on the website.

    body {
  font-family: Arial, Helvetic         


        
2条回答
  •  温柔的废话
    2020-12-22 04:04

    To have Multiple Backgrounds on a Single Element:

    .myclass {
      background: background1, background2, ..., backgroundN;
    }
    

    More complex example:
    3 backgrounds with other background properties:
    Note1: You can define background-repeat and background-position (and others like background-size) properties for each of the 3 backgrounds individually.

    .multi_bg_example {
      /* Background 1, an image   */ background: url(img1),
      /* Background 2, a gradient */ linear-gradient(to right, rgba(255, 255, 255, 0),  rgba(255, 255, 255, 1)),
      /* Background 3, an image   */ url(img3);
      background-repeat: no-repeat, no-repeat, repeat;
      background-position: bottom right, left, right;
    }
    

    Note2: The first one appears on top, second one below it, etc...

    Source: Mozilla Developer Network, CSS multiple backgrounds:
    http://developer.mozilla.org/en-US/docs/CSS/Tutorials/Using_CSS_multiple_backgrounds

提交回复
热议问题