• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3483
  • Last Modified:

XHTML and table cell background images

<td background="some-image.jpg"> fails the w3c test but it works in most browsers. I tried changing it to an inline style and then in an external stylesheet and set repeat-y but the page layout was messed up.  Is <td background= just a fail for strict xhtml, does it pass a lower level test?
0
ncw
Asked:
ncw
  • 2
  • 2
1 Solution
 
walkerkeCommented:
All style elements should be moved to the style attribute for w3c compliance. Try this:

<td style="background-image: url(some-image.jpg);">

This should work and is w3c compliant. If that doesn't produce what you expect, is it available on the web for me to view?
0
 
ncwAuthor Commented:
I'm familiar with the style you have given, but there seems to be a problem when used inconjunction with the <img> tag inside a table cell. What I'm trying to do is to display an image (inside ing tags in the cell) and then continue with the background image for the remainder of the cell height below the main image. 'background=' handles this ok but not css.
0
 
walkerkeCommented:
Is your page posted so that I can view it? I'm not sure what you mean. If you want the background to repeat, you should include that property:

<td style="background-image: url(some-image.jpg); background-repeat: repeat;">

If you only want it to repeat vertically, set the value to "repeat-y".
0
 
ncwAuthor Commented:
You're absolutely write .... it worked today, don't know what was wrong yesterday!

Just left with once validation error where I've used a name property in an image tag to do a rollover.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now