?
Solved

XHTML and table cell background images

Posted on 2006-07-13
4
Medium Priority
?
3,469 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

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…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

770 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