Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BACKGROUND property on TD ELEMENT - W3C Standards

Status
Not open for further replies.

jaredc

Programmer
Jun 28, 2002
43
GB
Hi

I've just been running some web pages through the HTML validator ( and have encountered an error stating that the background property is not supported on TD element.

The web page seems to be working as intended when viewed through IE5 (and the relevant part of the page working ok when viewed through Netscape6/6.01) but ideally I'd like to make my webpages compliant with W3C standards.

Having checked out the specification for HTML 4.01 I am still a little unsure whether there is any alternative to the background property on a TD element and if anyone has any advice or thoughts they would be gratefully received.
 
Thanks for that Gary, I wanted to inlcude an image as the background for a TD and have come up with the following code:
Code:
<style type=&quot;text/css&quot;>
.Test
{
background-image: URL(images/btnHome.gif):
}
</style>

...

<TABLE>
 <TR>
  <TD CLASS=&quot;Test&quot;>
  </TD>
 </TR>       
</TABLE>
I don't seem to be able to get the image to display, I've also tried setting the styls as TD.Test but this isn't working either. I am becoming confused?
 
I see one thing
background-image: URL(images/btnHome.gif):
that colon needs to be a semi colon
background-image: URL(&quot;images/btnHome.gif&quot;);
plus the &quot; &quot; as you see in that revised line A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
Scratch that last bit, I've got it working by amending the location of the image to &quot;../images/btnHome.gif&quot; - So I was nearly there!
 
As a follow up to the above, I've been using a TABLE to create a coloured line down the side of a page;
Code:
<TABLE WIDTH=2px>
 <TR>
  <TD WIDTH=2px HEIGHT=200px BGCOLOR=BLUE>
  </TD>
 </TR>
</TABLE>
which gives the desired effect through IE browsers but saddly not through Netscape (tested on 6.01). I've tried using CSS to specifiy the BGCOLOR of the TD/TABLE element but the same happens, i.e. works on IE but not Netscape. As an alternative I can simply create an image to show a coloured line on the screen but I would be interested if anyone has any suggestions or thoughts regarding use of BGCOLOR property on the TD and TABLE elements in association with Netscape. Many thanks in advance!
 
Thanks for that Wullie, I initially found that where I introduced the &nbsp; it made the lines too wide/high where I was specifying a very small width/height (e.g. 2px) but I seem to have sorted this by introducing a style with a very small font size for this bit. Won't be able to test it through Netscape until tommorow though - so fingers crossed!

By the way - thanks to onpnt, I missed your comments earlier (we must have posted almost simultaneously!)
 
That's what I use and I'm Netscape compatible:). You can uncross now.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top