Marc Marc - 6 months ago 40
CSS Question

Semi-transparent color layer over background-image?

I have a DIV and I would like to put a pattern as background. This pattern is gray. So to make it a little more nice, I would like to put a light transparent color "layer" over. Below is what I tried but which did not work. Is there a way to put the colored layer over the background image? Thank you in advance for your replies. Cheers. Marc.

Here's my CSS:

background: url('../img/bg/diagonalnoise.png');
background-color: rgba(248, 247, 216, 0.7);

Answer Source

Here it is:

.background {
    position: relative;

.layer {
    background-color: rgba(248, 247, 216, 0.7);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

HTML for this:

<div class="background">
    <div class="layer">

Of course you need to define a width and height to the .background class, if there are no other elements inside of it

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download