SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 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">
    &copy;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

    D

  2. #2
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,272
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    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.

  3. #3
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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">
    &copy;<?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

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Dannilee View Post
    <td height="25" width="100% " background="' . URL . '/templates/' . $cookie_template . '/images/x.gif">
    If you want to keep that inline in the code then change it to:

    Code:
    <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.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi

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

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    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.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  7. #7
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

    Dee

  8. #8
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    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.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  9. #9
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  10. #10
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,114
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by Dannilee View Post
    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.
    Something like this:

    Code:
    <td height="25" width="100%" class="image"  background="' . URL . '/templates/' . $cookie_template . '/images/x.gif">
    Add the red and remove the blue, and then in the CSS file add this:

    Code:
    .image {background: url(path-to-image);}
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  11. #11
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,272
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    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.

  12. #12
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, that worked great 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

  13. #13
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    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.

  14. #14
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I realised it's the scrollbar that it doesn't like not the #.

    Thanks again for all your help

  15. #15
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  16. #16
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    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.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •