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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I do a W3C compliant table cell background image 2

Status
Not open for further replies.

mkrausnick

Programmer
Joined
Apr 2, 2002
Messages
766
Location
US
I'm trying to bring my web site into compliance with W3C standards (just HTML 4.01 transitional for now) and I'm doing pretty well except I ran into this problem:
Code:
<td width="76" height="104" align="center" valign="bottom" style="border-style: ridge" background="/images/bulletin.gif">...
won't validate because according to the validator the BACKGROUND attribute is not valid HTML 4.01 transitional for TD. I have a link within the cell that sits on top of the image. It just isn't as cool without the image under the link. How can I do this?

The page is if you want to see what I'm doing.


Mike Krausnick
Dublin, California
 
Code:
<td width="76" height="104" align="center" valign="bottom" style="border-style: ridge; background-image:url('/images/bulletin.gif');">

Rick

 
In addition to RISTMO's answer ...

To make the style re-usable, you can make a CSS class like this:

Code:
td.bulletin {
  width:76;
  height:104px;
  text-align:center;
  vertical-align:bottom;
  border-style:ridge;
  background-image:url(/images/bulletio.gif);
}

Then you can use this where applicable:

Code:
<td class="bulletin">...</td>

Regards


Jakob
 
Rick,
Thanks for the syntax - I couldn't find it anywhere.

Jakob,
Thanks for the CSS with example usage. That would have been my next question - you must be psychic!

Stars to you both!

Mike Krausnick
Dublin, California
 
mkrausnick,

Thanks for the star!!

You say you couldn't find it anywhere - here's a good reference for you:


They have some good reference guides (look at right side).

Regards


Jakob
 
Yeah, W3schools is what I use the most. That's why I was puzzled. The <TD> tag definitiion in both HTML 4.01 and XHTML 1.0 doesn't mention the backgound-image atribute, which I assume is because it's a style. Thanks to both your excellent advice I understand it now.



Mike Krausnick
Dublin, California
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top