The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End IE8 PHP solution for last-of-type selector in loop?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #35640

    I place a div around the five latest posts to display a dotted border between the posts. There is no border after the last post thanks to the last-of-type selector. It works perfectly well, but not in IE8 which lacks support. Can anyone help with a PHP solution for IE8?

    while ($my_query->have_posts()) : $my_query->the_post();

    "; the_title(); echo ""; ?>

    The css: {
    border-bottom: 1px dotted #b4b4b4;
    } {
    border: none;

    The snippet below was recommended in a post by Chris Coyier:

    if (($wp_query->current_post + 1) < ($wp_query->post_count)) {
    echo '
    Post Divider

    But it displays the divider above the top/newest post as well as between the posts.


    One thing IE8 does now is :first-child. So you can change the border-bottom to border-top and then remove it from the first item instead of the last.


    Thank you! That is very simple and solves my problem. No need for PHP or IE hack.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.