I am attempting to hide all of the margin during my Wordpress_Query when the query returns no posts.

Begin to see the query and margin below.

<div class="sidebar-item">

    <?php 

        $currentID      = get_the_ID();
        $upcoming       = new WP_Query(array(

        'post_type'         => 'page',
        'post_parent'       => 835,
        'order'             => 'DESC',
        'posts_per_page'    => 3,
        'post__not_in'      => array($currentID)

    )); ?>

    <div class="sidebar-item-wrap">

        <h1 class="pagetitle-blue"><?php _e('Upcoming Events','theme'); ?></h1>

        <ul class="sidebar-list">

        <?php if ($upcoming->have_posts()) : while ($upcoming->have_posts()) : $upcoming->the_post(); ?>

            <li>

                <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="sidebar-thumb" style="">
                    <?php the_post_thumbnail('mini-thumb', array(
                        'title' => trim(strip_tags( $attachment->post_title ))
                    )); ?>
                </a>

                <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="sidebar-title"><?php the_title(); ?></a>

                <p><?php the_advanced_excerpt('length=8&use_words=1&no_custom=1&ellipsis=%26hellip;&read_more=view page&add_link=1'); ?></p>

            </li>

        <?php endwhile; unset($upcoming); endif; ?>

        </ul>

    </div>

    <div class="sidebar-item-foot">

        <a href="#" title="view more page"><?php _e('view more page','theme'); ?></a>

    </div>

</div>

Right now query works fine. The problem I've, when the query returns no results it still results the markup. Please visit below.

<div class="sidebar-item">    

    <div class="sidebar-item-wrap">

        <h1 class="pagetitle-blue"><?php _e('Upcoming Events','theme'); ?></h1>

        <ul class="sidebar-list">

        </ul>

    </div>

    <div class="sidebar-item-foot">

        <a href="#" title="view more page"><?php _e('view more page','theme'); ?></a>

    </div>

</div>

It's probabably rather easy fix, but I am not 100% sure regarding how to split up the if, while claims etc.