Forum Moderators: open

Message Too Old, No Replies

Table Background Image

What validates?

         

ScottM

11:23 pm on Aug 3, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am trying to produce a small table that has a background image using the 'background' attribute.

W3C says it's 'deprecated...don't use it'.

Ok...

Then what do I use?

(CSS is out of the question for this application)

tedster

2:15 am on Aug 4, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Bad news: CSS is the reason the background attribute is deprecated. CSS or a deprecated attribute, those are your choices as far as I know.

I'd like to understand why CSS is "out of the question", and yet there is a need to validate. That sounds like a double bind to me.

rewboss

1:05 pm on Aug 4, 2002 (gmt 0)

10+ Year Member



"Deprecated" doesn't really mean "don't use it ever", unless you're trying to validate to a recent Strict DTD (e.g. XHTML1.0 Strict). It should still validate to a transitional DTD, although the validator might issue warnings.

"Deprecated" means "avoid using it if at all possible, because it might not work in future and then you'll have to rewrite all your HTML". But, like tedster, I am mystified as to why you can't use CSS.

bobriggs

1:19 pm on Aug 4, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, the 'background' attribute is not deprecated. It's just plain illegal. (only defined for <body>, in both 4.01 Transitional and 3.2.

[added]
That was kind of unclear - It's not defined in <table> but it is deprecated in <body>

ScottM

1:31 pm on Aug 4, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I should clarify, I maybe could use in-line CSS.

This is going to be a reciprical link or sort of a banner.

tedster

1:44 pm on Aug 4, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You're right, Bob, it's simply not in the W3C spec.

So enough beating around the bush. This is the answer to the question "What Validates?"

<table style="background-image:url(bg.gif)">
<tr>
<td>content</td>
</tr>
</table>