Forum Moderators: open

Message Too Old, No Replies

XHTML Validation prob

         

itm2k5

11:26 pm on Jan 3, 2005 (gmt 0)

10+ Year Member


I'm down to one problem on validating a page as XHTML 1.0 Transitonal, and as you've probably guessed, I need help with it :)

The validator says:

Line 39, column 32: there is no attribute "background"

<td width="42" background="images/main/sidebar_left.png" height="172">&nbs

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.

And the code up to the error (last line) is this:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="content-language" content="en-nz" />
<meta name="description" content="me" />
<meta name="keywords" content="me" />
<title>iČ.net.nz // Main</title>
<link rel="stylesheet" type="text/css" href="site_files/css/me.css" media="screen" />
<link rel="icon" type="image/x-icon" href="site_files/favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="site_files/favicon.ico" />
</head>
<body background="images/main/stripes.png">
<div align="center">
<table border="0" width="835" id="main" cellpadding="0">
<tr>
<td width="42" background="images/main/sidebar_left.png" height="172">&nbsp;</td>

I've rattled my brain over this for a long time but I'm totally oblivious to my error. Please help, I'd really appreciate it!

pageoneresults

11:32 pm on Jan 3, 2005 (gmt 0)

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



Hello itm2k5, Welcome to WebmasterWorld.

Background is not a valid attribute in XHMTL. You'll need to assign the background image to that <td> via CSS...

.sbl{
color:#fff;
background:#fff url(/images/main/sidebar_left.png.gif) repeat-x;
}

<td [b]class="sbl"[/b] width="42" height="172">

itm2k5

4:13 am on Jan 4, 2005 (gmt 0)

10+ Year Member



Thank you! I've read the xhtml specs and 10 different how-to articles on the web but I still didn't know that backgrounds weren't allowed on tables.
But now I have another problem: I've used CSS and used the class attributes in my <td> tags, but in Firefox, the backgrounds are all blank but in IE they're fine!