homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

background problem
image overriding color
mechanical messiah

 11:26 am on Mar 29, 2003 (gmt 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)

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)

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)

Color and Background Properties [webmasterworld.com]


mechanical messiah

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

thank you so much drdoc...

everyone at this site is so helpful


 11:55 am on Apr 2, 2003 (gmt 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?

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved