WordPress.org

Ready to get started?Download WordPress

Forums

Validation - div tag problems (3 posts)

  1. Wishful
    Member
    Posted 8 years ago #

    Hi,

    Complete novice with XHTML here. This is my first post because I've been browsing the forums for a few days and have found answers to all my questions except the following two. So a big thank you to to everyone who has contributed their knowledge to these forums.

    I'm trying to validate my first blog, and have got the errors down from 26 to 4 (which is actually 2 since one of them is repeated 3 times).

    My blog is at http://www.wishfulthinking.co.uk/blog and I've made a few modifications to the Letterhead theme.

    1. '"div" omitted, but OMITTAG NO was specified.'

    The relevant code from my header.php is:

    <body>

    <div id="page"><div id="header">
    ">

    <object><img src="title.png" alt="Wishful Thinking - creativity, coaching, business" /></object>

    </div></body>

    The error message indicates that the unclosed tag is <div id="page">. But if I insert another </div> before </body>, then this messes up the whole theme - all the content below the header moves right up against the left margin.

    I've found it validates if I self-close the tag, i.e. <div id="page" />. Is this OK or is there likely to be a connection with the next problem?

    2. I'm getting 'document type does not allow element "div" here' in relation to the following tags at the start of these documents:

    page.php begins:

    <?php get_header(); ?>

    <div id="content" class="narrowcolumn">

    sidebar.php begins:

    <div id="sidebar">

    and footer.php begins:

    <div id="footer">

    Thanks in advance for any help, apologies if any of this is obvious.

  2. Monika
    Member
    Posted 8 years ago #

    any element in html is like a box..like a russian puppet,

    ;)
    this div class page is the first after body
    so you have to close
    before </body></html> in the footer.php

    I'll found a big error in your sourcecode.

    you close the body tag before the body is over..

    <body>

    <div id="page"><div id="header">

    <object><img src="title.png" alt="Wishful Thinking - creativity, coaching, business" /></object>

    </div></body>

    this is the big error,
    delete this

    body must be closed before </html> in the footer.php

    kindly regards
    Monika

  3. Wishful
    Member
    Posted 8 years ago #

    Thanks Monika!

    I've deleted </body> from header.php and put it before </html> in the footer.php, which seems to have solved it.

    I still have to self-close <div id="page"> as <div id="page" /> instead of using </div> - any idea why that is?

    It's great to see the XHTML validation message - now for the CSS validation...

Topic Closed

This topic has been closed to new replies.

About this Topic