Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using <li> within a floating DIV? Works, but site no longer validates

    I have a floating DIV on my site that uses PHP to select news articles out of an SQL database.

    I use echo to print the news articles:

    Code:
    echo "<ul>";
    echo "<li>" . date('F j, Y', strtotime($date)) . " - " . $news . "</li>"; 
    echo "</ul>"
    Which outputs:
    <ul>
    <li>Month Date, Year - Article</li>
    <li>Month Date, Year - Article</li>
    ...
    </ul>

    But now the page no longer validates as XHTML:

    Line 40, column 10: document type does not allow element "ul" here; missing one of "object", "ins", "del", "map", "button" start-tag

    <ul><li>January 20, 2005 - This is a test</li><li>January 16, 2004 - Welc

    The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

    One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

  • #2
    New Coder
    Join Date
    Jan 2005
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nevermind, I got it.

    I didn't see that I had this code within a <p> </p>


  •  

    Posting Permissions

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