Forum Moderators: open

Message Too Old, No Replies

Background Images in Table Cells

Is it ok to do this?

         

newnewbie1

1:20 pm on Mar 26, 2003 (gmt 0)

10+ Year Member



I've got a table cell with the following code:

<td align="right" valign="top" background="images/topStripe3Flipped.gif"><img src="images/spacer.gif" width="1" height="10"></td>

And I'm running an HTML code validator and getting errors on that line... Is it not cool to have a background image for a table cell? Is that just for very OLD versions of browsers?

Any opinion would be greatly appreciated!

Birdman

1:30 pm on Mar 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure which version of HTML you are validating but, you should check into using CSS [w3.org] for all your styling. You could accomplish the same same thing like this:

<td style="text-align: right; background-image: url(images/topStripe3Flipped.gif);"><img src="images/spacer.gif" style="width: 1px; height: 10px;"></td>

Or better yet, put those styles in the head of your document:

<head>
<style type="text/css">
td.test{
text-align: right;
background-image: url(images/topStripe3Flipped.gif);
}

.test img{
width: 1px;
height: 10px;
}
</style>
</head>

Or even better, link to an external CSS [w3.org] file:

<head>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>

Do a site search for: CSS [w3.org] Crash Course

newnewbie1

1:43 pm on Mar 26, 2003 (gmt 0)

10+ Year Member



Hey Birdman!

Great idea! I am using CSS, but not to it's fullest exent. I will make these changes.

THANKS!