WC3 Can't validate final 3 errors

Hi

The script on my site had a ton of errors, I have managed to fix all but the last 3 (2 errors and 1 warning).

Please can someone advise me what is wrong and how to fix them.

First Error:

There is no attribute “BACKGROUND”

… height=“25” width="100% " background="http://www.mysite.com/te…

Second Error:

Error message:

End tag for “TABLE” omitted, but its declaration does not permit this

</div>

You forgot to close a tag, or
you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.

The next message, “start tag was here” points to the particular instance of the tag in question); the positional indicator points to where the validator expected you to close the tag.

The position of code it references:

<span class=“timings”>
©2013 Mysite.com <br><br>
<br>
</span>
</div>
</div>
<!-- Footer : end –>
</body>
</html>


3rd - Warning

Start tag was here

<table width=“800” cellpadding=“0” cellspacing=“0” border=“0” bgcolor=“#F6F3DA”>

Thanks in advance for any help :slight_smile:

D

First Error:

There is no attribute “BACKGROUND”

… height=“25” width="100% " background="http://www.mysite.com/te…

You have an element with a background attribute. No such attribute exists. So remove it.

This is an attribute (in bold)
<element foo=“bar”>Text</element>

It looks like you want to add a background image to an element. If the element doesn’t already have an id attribute or class attribute, you can give it one and state the background image in the CSS stylesheet instead.

<element class=“image”>Text</element>

in CSS
.image {
background: url(referencetheimage.png) 0 0 no-repeat;
}
is an example.

Second Error:

Error message:

End tag for “TABLE” omitted, but its declaration does not permit this

</div>

You forgot to close a tag, or
you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed.

So did you find your </table> tag? Unless you’ve got lots and lots and lots of hairy code, you should be able to make sure that for every <table> tag, there’s a </table> tag.

You can get this error also though if you did something like wrap a table in some inline element (like a span or an anchor). Those is no-nos.

3rd - Warning

Start tag was here

<table width=“800” cellpadding=“0” cellspacing=“0” border=“0” bgcolor=“#F6F3DA”>

Don’t worry much about this error. When you fix error #2, it will also solve this error #3. What error #3 tells you is where to start counting your <table> tags so you know if you have enough </table> tags.

Hi

Thank you for your reply.

The code for the first error outputs as HTML but it is actually taken from a php file, can you advise me where in the below code the element part would go?

<td height=“25” width=“100% " background=”’ . URL . ‘/templates/’ . $cookie_template . '/images/x.gif">

No I haven’t been able to find the </table tag> this HTML is outputted from the PHP file, below is all the code for footer.php
<!-- Footer : start –>

<!-- Main Content table : stop –>
</td>
</tr>
</table>

</table>

<div align=“right”><br>

<span class=“timings”>
©<?php echo date(‘Y’); ?> <?php echo $conf[‘website_name_short’]; ?>
<br><br>
<?php include (PATH . ‘/includes/timings.php’); ?>
<br>
</span>
</div>

</div>

<!-- Footer : end –>

</body>
</html>
<?php include ( PATH . ‘/includes/common_footer.php’ ); ?>

It says it’s on line 3224, I have highlighted that line in red on the above code.

Thanks again

D

If you want to keep that inline in the code then change it to:

<td style="height:25px;width:100%;background:'. URL . '/templates/' . $cookie_template . '/images/x.gif">

The simplest way to fix the table error is to remove the table that you currently have incorrectly wrapped around your content. The content isn’t tabular data and so shouldn’t be in a table at all.

Hi

Thanks, but I tried those two things but it messed up the actual page layout, the spacing was all out of whack:(

It would be easier if we could see the page. You seem to be including the footer below the closing </html> tag, but nothing should appear below that.

Hi

Well I didn’t write the code but I am trying to clean it up, the page is (flamingolandrentals.co.uk) I haven’t linked it as I don’t want this link indexed.

Again any help with these last couple would be much appreciated :slight_smile:

Dee

On line 3224, you could try a few things, like replace the </div> with </table>, or just add </table> etc. (It’s a bit hard to know what’s supposed to be there without trawling through all the code and matching tags, which is a bit of a pain.

felgall’s suggestion was a good one. Could you post here the code you used to try his suggestion about the background?

These errors are not serious. The validator is just there to flag potential issues, but if the site is rendering fine, it’s not the end of the world. Still, it’s nice to clean things up.

hi

Well I tried replacing it with </table> and it messed up the page, so I put it back to how it was it originally and now for some reason it validates (shrug).

That only leaves me with the first error. I tried as felgall suggested:

<td style=“height:25px;width:100%;background:'. URL . ‘/templates/’ . $cookie_template . '/images/x.gif”>

but whilst it past validation the spacing between the different sections of my page messed up.

Stomme poes - Suggested to add an attribute tag to it, but I’m unsure where in the code I would place it? the css part I understand.

Thanks

D

Something like this:

<td height="25" width="100%" [COLOR="#FF0000"]class="image"[/COLOR]  [COLOR="#0000CD"]background="' . URL . '/templates/' . $cookie_template . '/images/x.gif"[/COLOR]>

Add the red and remove the blue, and then in the CSS file add this:


.image {background: url([I]path-to-image[/I]);}

Choose a name that best describes the element or why it has an image or something, if you can. “image” was only an example because we have zero context.

Thanks, that worked great :slight_smile: No more errors.

Just one final question, is there another way to write color codes for firefox, rather that #000000, I am trying to validate my CSS and these are the only errors.

Thanks again for all your help :slight_smile:

There is nothing wrong with with hex colour of; #000000 you probably have an error elsewhere in the CSS, with CSS you could have used; rgb(0,0,0); or just shorthand #000 or the color name value of; black in this case.

I realised it’s the scrollbar that it doesn’t like not the #.

Thanks again for all your help :slight_smile:

Hi

I had to roll back the header file because I found a problem on the live site, now I have 2 more errors:

No background attribute again:

<table width=“100%” cellpadding=“0” cellspacing=“0” border=“0” class=“image” background=“’ . URL . ‘/templates/’ . $cookie_template . '/images/x.gif”">

I tried adding the class tag again like the above but it hasn’t worked this time.

The other error is what I think removing may have messed up the functioning of my site, it says:

document type does not allow element “BODY” here

If you look at the page source (flamingolandrentals.co.uk) you will see on line 114 there is a <body> tag, in the php file I tried deleting it and the text editor on my site doesn’t show.

Thanks again for any help :slight_smile:

There are other errors that the Validator didn’t catch such as in the invalid hex colours. Though the BODY start tag SHOULD NOT have a space before the right “>” <body > it of course should be written <body> and start BODY tag MUST come directly after the closing HEAD tag that will solve some issues.

Background images should always be the domain of CSS not HTML so use CSS for any background images on the TABLE. HTML is a structural language and doesn’t concern itself with any such decoration.