Forum Moderators: not2easy

Message Too Old, No Replies

Using Image as background

         

guanajay

8:57 pm on Oct 25, 2005 (gmt 0)

10+ Year Member



I'm trying to use an image as a background.
<td width="2%" background="/images/cornerblue.gif">&nbsp;</td>
when checking the page on w3c.org keep getting an error message that background it's not supported, looking everywhere for some info but so far have not found any.
Any input?

Fotiman

9:01 pm on Oct 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You should be using CSS for presentation. Background images are considered presentation.

It also looks like you're trying to use tables for layout. That too is a no no. :) Check out this article for some useful rounded corner examples using CSS instead.

Search for an article on A List Apart on MountainTop Corners

Good luck.
-Peter

I tidied reference, Suzy

[edited by: SuzyUK at 10:11 pm (utc) on Oct. 25, 2005]
[edit reason] sorry no URLs see TOS #13 [WebmasterWorld.com] [/edit]

SuzyUK

9:08 pm on Oct 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi guanajay and Welcome to WebmasterWorld!

background="/images/cornerblue.gif"

should be

style="background: url(/images/cornerblue.gif)"

background is not a supported attribute..

butd seeing as you're in the CSS forum I presume you're trying to CSS it.. :) so it should be declared via the style attribute as shown above (or in an external stylesheet) using the CSS Background property [w3.org]

Suzy

Don_Hoagie

9:48 pm on Oct 25, 2005 (gmt 0)

10+ Year Member



It is against the Forum Charter to post non-authoritive URLs. Have a read when you get the chance [webmasterworld.com]. The URL you posted will also be taken care of shortly I imagine.

SuzyUK summed it up just fine, and pointed out the error, but I think perhaps if guanajay is a newbie-CSSer, it might be more informative perhaps to post some more info:

"Background" will cover you for anything having to do with a background, as SuzyUK pointed out. But the specific attribute defined by CSS, contained within that all-encompassing "background" attribute, is "background-image"; i.e.

style="background-image: url(example.jpg);"

If your sole interest is to use CSS to insert a background image, you would use that line of code, or get rid of the "-image" if you like.

[edited by: SuzyUK at 10:15 pm (utc) on Oct. 25, 2005]
[edit reason] a little tidying.. [/edit]

guanajay

1:19 am on Oct 26, 2005 (gmt 0)

10+ Year Member



Thanks