Solved

XHTML and table cell background images

Posted on 2006-07-13
4
3,443 Views
Last Modified: 2008-01-09
<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
Comment
Question by:ncw
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:walkerke
ID: 17109517
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
 
LVL 1

Author Comment

by:ncw
ID: 17109683
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
 
LVL 11

Accepted Solution

by:
walkerke earned 250 total points
ID: 17110578
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
 
LVL 1

Author Comment

by:ncw
ID: 17113908
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question