user2327201
user2327201

Reputation: 409

CSS Background color with image

I have a background image and below that I want to have a color.

I have this CSS:

body {
    background: url('/images/background.jpg');
    background-color: #000;
}

But the image appears with no color. I've also tried this:

body {
    background: #000 url('/images/background.jpg');
}

But that doesn't work either. What am I doing wrong?

Upvotes: 0

Views: 252

Answers (4)

John Doe
John Doe

Reputation: 15

Use in this way background: #657b78 url('../images/background.jpg') repeat top left;. Do not forget to check if the URL of such image is correct.

Upvotes: 0

Teffi
Teffi

Reputation: 2508

Your background color is actually working but it is being overlapped by declaring a background-image. Unless your image supports transparency like .png and opacity was declared. You would be able to view your bg-color.

It will help if you provide us your exact image and the output you want to achieve.

Upvotes: 0

Adriano Machado
Adriano Machado

Reputation: 107

What do you really want? The background color around the image background or in the back of the image? If it's in the back of the image you have to use an .png (transparent) image and the background: #000 url('/images/background.png');

Upvotes: 1

monkeyinsight
monkeyinsight

Reputation: 4859

background: #000 url('/images/background.jpg');

Upvotes: 0

Related Questions