Search code examples
cssbackground-imagebackground-color

Multiple background-color layers


I wondered if it was possible to create two background-colors for a div an overlay them.

I want a white background-color so that the content below this div doesn't shine through and another rgba() color painted over this white to create lighter colors per script.


Solution

  • Without understanding why you want this, it can be done by using solid color gradients: fiddle.

    body {
        background: linear-gradient(rgba(220,14,120,0.5), rgba(220,14,120,0.5)),
                    linear-gradient(white, white); /* first bg is on top of this */
    
    }