SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Element div not allowed as child of element ul in this context

    getting the following validation error:
    "Element div not allowed as child of element ul in this context. (Suppressing further errors from this subtree.) "

    for this bit of code:


    <div class="section_thumbnails group">
    <h3>Recent Posts</h3>
    <ul>
    <!-- LOOP START -->
    <?php $the_query = new WP_Query( 'showposts=3' ); ?>
    <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
    <!-- THIS DISPLAYS THE POST THUMBNAIL, The array allows the image to has a custom size but is always kept proportional -->
    <div class="col span_1_of_3">
    <div class="post-thumbnail">
    <li> <?php the_post_thumbnail( array(70,70) );?></li>
    </div>
    <div class="blog-lists-title">
    <!-- THIS DISPLAYS THE POST TITLE AS A LINK TO THE MAIN POST -->
    <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>

    <!-- THIS DISPLAYS THE EXCERPT OF THE POST -->
    <p><?php echo get_excerpt(); ?>
    <!-- READ MORE LINK -->
    <a href="<?php the_permalink() ?>">More...</a></p>
    </div>
    </div>
    <?php endwhile;?>
    <!-- LOOP FINNISH -->
    </ul>
    </div>


    Anyone know a fix for this? I have tried a few things but can't get it to both display correctly and validate at the same time.

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,313
    Mentioned
    178 Post(s)
    Tagged
    9 Thread(s)
    Hi there,

    AFAIK, the only permitted child of a <ul> element is a <li> element. <li> elements can have block elements (such as a <div> element) as a child, but <ul> elements cannot.

    If you wish for some help tidying up your code, please post the HTML generated by the PHP, as outlined in this post: http://www.sitepoint.com/forums/show...=1#post5410283

    You might also want to consult 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
  •