Forums / Templates, Stylesheets, Page Layout / Css background img + background color

Css background img + background color

Locked

Views: 6,076

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
17 May 2010, 11:53 AM
#1
missanna avatar

missanna

New Zenner

Join Date:
May 2010
Posts:
15
Plugin Contributions:
0

Css background img + background color

Hi, I want a background img and also background color, because the background image is not that big, just half the page and then the rest is white color, but then i want same color as the background have at the bottom so it looks like they are connected, but how to do this, i know i have done this before...

body {
margin: 0;
font-family: arial, helvetica, sans-serif;
font-size: 0.72em;
color: #333333;
background: #000000;

background: url("http://www.spacetelescope.org/static/images/background.jpg") repeat-x;
line-height: 17px;
}

^^ that how it looks in my css, but only the image is showing not the baground color i have choosed there, i also tried with background-color: #0000000 but that didnt work either, if i remove the image then its black #0000000 color at the background but not when i have image background 2, i want them both.... i have fresh install, nothing changed....

17 May 2010, 12:08 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: Css background img + background color

You're setting your background twice, so the second one replaces the first.

When you had the color listed separately the same thing happened, since the "background" style replaces all the individual elements that preceded it such as background-color.

You have two options:

either use backround-color, background-image, etc to set each part separately

OR

combine them into a single statement such as
background: #000000 url("http://www.spacetelescope.org/static/images/background.jpg") repeat-x;

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

17 May 2010, 12:12 PM
#3
missanna avatar

missanna

New Zenner

Join Date:
May 2010
Posts:
15
Plugin Contributions:
0

Re: Css background img + background color

ahh yes now it worked!
Thanks man, really appreciate it! :clap: