Solved

XHTML and table cell background images

Posted on 2006-07-13
4
3,431 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now