Forum Moderators: open

Message Too Old, No Replies

Validation problem - td doesnt have an attribute "background"

         

fendy

3:05 am on Nov 5, 2006 (gmt 0)

10+ Year Member



I am using dreamweaver for building my site and i have this error in html validation

<td background="images/navbarboth.jpg">

it says

the tag td doesnt have an attribute :"background" in currently active version HTML 4.0

What does this mean, does that mean that i can not add the picture to the background of the table to make it compliant?

Thanks you

keyplyr

10:04 am on Nov 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Background images must be defined in CSS.

td {
background:url(http://www.your-domain.com/mages/navbarboth.jpg) repeat;
color:#000;
}

penders

12:48 pm on Nov 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just for the record... I think the BACKGROUND attribute was only ever valid for the <body> tag. Although this is now deprecated (still valid under am HTML 4.01 loose DOCTYPE).

I think the BACKGROUND attribute on other elements, such as the <td> tag, was initially IE only. Although it was later adopted by other browsers, it never made the W3C specification.

As keyplyr says, you need to use CSS.

g1smd

8:19 pm on Nov 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Using CSS makes the whole design process far easier.

Start by marking up your content as headings, paragraphs, lists, tables, forms (and images). Those are the main building blocks.

Write a default style for each of those types of content.

Next add class names to any blocks of content that are going to be displayed differently to that default: the footer paragraph and the navigation list for example, and then define the styles for those classes too.

You've now got a template for the whole site to use.