Welcome to WebmasterWorld Guest from 50.17.117.221

Forum Moderators: not2easy

Message Too Old, No Replies

background problem

image overriding color

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

New User

10+ Year Member

joined:Mar 22, 2003
posts:30
votes: 0


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]

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


Use 'background-color' rather than 'background'. Also, I don't think you need to wrap the image's path with quotes.
5:06 pm on Mar 29, 2003 (gmt 0)

Senior Member

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

joined:Mar 15, 2002
posts:6807
votes: 0


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!

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

Senior Member

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

joined:Feb 4, 2002
posts:5044
votes: 0


Color and Background Properties [webmasterworld.com]

Nick

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

New User

10+ Year Member

joined:Mar 22, 2003
posts:30
votes: 0


thank you so much drdoc...

everyone at this site is so helpful

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 27, 2003
posts:664
votes: 0


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?