Welcome to WebmasterWorld Guest from 50.19.156.19

Forum Moderators: not2easy

Message Too Old, No Replies

background problem

image overriding color

     

mechanical messiah

11:26 am on Mar 29, 2003 (gmt 0)

10+ Year Member



keep in mind, this is in php.

shouldn't this work?


.dotitle { text-decoration:none; background-image: url("topbarbg.gif"); background: <? echo $bgcolor2;?>; ont-size:11px; font-weight:bold; font-family:Arial, Helvetica, sans-serif }

well it doesn't. that makes it so that only the background color displays and not the image. but if i take out the "background:" part and leave just "background-image:" then only the background image will show and not the background color.

i want both to work, so that while it's loading it will still atleast have the background color.

keep in mind, that's in my theme's "default" file, and in the functions.php file for $dotitle i can set the table background color but that disables the image.

go to <snip> to see what i mean, as it loads it looks all messed up but once it's loaded it looks nice.

[edited by: Nick_W at 12:19 pm (utc) on Mar. 29, 2003]
[edit reason] no urls please [/edit]

Birdman

12:48 pm on Mar 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use 'background-color' rather than 'background'. Also, I don't think you need to wrap the image's path with quotes.

DrDoc

5:06 pm on Mar 29, 2003 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



background is shorthand for background-color background-image background-repeat background-attachment background-position. Anything omitted will receive its default setting. In this case, no background image.

You have several options.

1) Either use only the background property:

background: #000 url(image/blah.gif);

2) Use the individual properties:
background-color: #000;
background-image: url(image/blah.gif);

3) Use the shorthand first, but use the individual properties to override:
background: #000 url(image/something.gif);
background-image: url(image/blah.gif);

The third example is quite redundant. The first example is recommended, but the second works as well. Just be consistent!

Nick_W

5:33 pm on Mar 29, 2003 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Color and Background Properties [webmasterworld.com]

Nick

mechanical messiah

9:29 pm on Mar 29, 2003 (gmt 0)

10+ Year Member



thank you so much drdoc...

everyone at this site is so helpful

ShawnR

11:55 am on Apr 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This thread is a bit old, so I hope someone is still reading it... ;-)

My understanding is that background is better supported by older browsers, hence preferable to the individual background-color, background-image, background-repeat, background-attachment, background-position.

Can anyone confirm if my understanding is correct?