Search code examples
htmlcssbackgroundpsd

Using a background image on top of a background colour in CSS


enter image description hereI have designed a webpage in PSD and I am in the middle of converting it. Within my main content I have a solid background colour but I have a glow effect on a separate layer which appears on top of the background colour.

I have a container that contains all the code, I have a header, main and footer. Within the main, I have added the solid background colour and also added the background image of the glow which I sliced from PSD. However, the solid background colour doesnt appear to show and it just shows the glow effect. Images below show what it looks like and what it should look like:


enter image description here

enter image description here

CSS:

Html {
background: white;
}

#container {
width: 955px;
height: 900px;
margin: 0px auto 0px auto;
}

#main{
background: url(../images/slogan.png) top left no-repeat;
background-color: #282d37;
height: 900px;
width: 955px;
}

Solution

  • You can use multi-background:

    #main {
      width: 900px;
      height: 955px;
      background: url(../images/slogan.png) no-repeat, #282d37;
    }​
    

    To explain: use background css option, first add image, than background color.

    LIVE DEMO