-1

I cannot for the life of me figure out why my footer is showing up in the middle of my webpage. I have my #content div set to have a height of 100% and have given it a relative position; and I even added an absolute position to my footer with bottom: 0;. What am I missing? I can't figure out what is causing it to not follow the normal flow of elements in the page!

I've checked several posts with this same problem, but the suggestion is almost always what I've tried above. I did try getting rid of the position for #content and the footer and instead setting display: inline-block; for both (was suggested in another post), and that didn't do anything.

Link to my in-progress page: http://freshcardsite.thewelllovedlife.com/home-use/

HTML for the Page (starting below the header):

<div class="site-content-contain">
<div id="content" class="site-content">
<div class="wrap">
<div id="primary" class="content-area">
    <main id="main" class="site-main consumer-page" role="main">

    <?php

    // vars
    $topsection = get_field('consumer_top_image_section');  

    if( $topsection ): ?>
        <div class="top-image" style="background-image: url(<?php echo $topsection['consumer_background_image']; ?>); background-size: cover; background-repeat: no-repeat; background-position: bottom center;">

            <div class="top-section">
                <div class="top-text">
                    <h1>Fresh Card</h1>
                    <p><?php echo $topsection['consumer_top_content']; ?></p>
                    <img src="<?php echo $topsection['consumer_top_icon']; ?>" />
                </div>  
            </div>

        </div>

    <?php endif; ?>

    <?php

    // vars
    $aboutsection = get_field('consumer_about_section');    

    if( $aboutsection ): ?>
        <div class="about-section">

            <div class="about-content">
                    <h2><?php echo $aboutsection['consumer_about_section_title']; ?></h2>
                    <p><?php echo $aboutsection['consumer_about_section_main_content']; ?></p>
            </div>

            <?php if($aboutsection['consumer_uses_section'] ): ?>

                <div id="tabs">

                        <ul class="tabs">

                        <?php foreach($aboutsection['consumer_uses_section'] as $use): ?>
                            <li><a href="#<?php echo $use['consumer_use_number']; ?>"><h3><?php echo $use['consumer_use_name']; ?></h3><img src="<?php echo $use['consumer_use_icon']; ?>" /></a></li>

                        <?php endforeach; ?>
                        </ul>

                        <?php foreach($aboutsection['consumer_uses_section'] as $use): ?>
                            <div id="<?php echo $use['consumer_use_number']; ?>">
                                <p> <?php echo $use['consumer_use_information']; ?> </p>
                                <p> <?php echo $use['consumer_use_video']; ?</p>
                                <p> <?php echo 
$use['consumer_second_use_video']; ?> </p>
                            </div>
                        <?php endforeach; ?>
                </div>

            <?php endif; ?>
        </div>
    <?php endif; ?>

    <div class="contact-section">
        <div class="contact-content">
            <h2>Contact Us</h2>
            <?php the_field('consumer_contact_section'); ?>
        </div>
    </div>

<?php if (have_posts() ) : ?>

    <div class="news-section">
        <div class="news-content">
            <h2>Awards & News</h2>
            <ul>

                <?php $the_query = new WP_Query( 'posts_per_page=5' ); ?>


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


                <li><a href="<?php the_permalink() ?>"><?php the_title(); ?>
</a></li>


                <li><?php the_excerpt(__('(more…)')); ?></li>


                <?php endwhile; wp_reset_postdata(); ?>
            </ul>
        </div>
    </div>

    <?php else : ?>

    <?php endif; ?>

    </main><!-- #main -->
</div><!-- #primary -->
</div><!-- .wrap -->

</div><!-- #content -->

    <footer id="colophon" class="site-footer" role="contentinfo">
        <div class="wrap">
            <?php
            get_template_part( 'template-parts/footer/footer', 'widgets' );

            if ( has_nav_menu( 'social' ) ) : ?>
                <nav class="social-navigation" role="navigation" aria-label="
<?php esc_attr_e( 'Footer Social Links Menu', 'twentyseventeen' ); ?>">
                    <?php
                        wp_nav_menu( array(
                            'theme_location' => 'social',
                            'menu_class'     => 'social-links-menu',
                            'depth'          => 1,
                            'link_before'    => '<span class="screen-reader-text">',
                            'link_after'     => '</span>' . twentyseventeen_get_svg( array( 'icon' => 'chain' ) ),
                        ) );
                    ?>
                </nav><!-- .social-navigation -->
            <?php endif;

            get_template_part( 'template-parts/footer/site', 'info' );
            ?>
        </div><!-- .wrap -->
    </footer><!-- #colophon -->
</div><!-- .site-content-contain -->
</div><!-- #page -->

And here's my relevant CSS

html, body {
height: 100%;
}

.consumer-page {
    min-width: 100%;
    margin: 0 auto;
    position: absolute;
    left: 0;
    top: 0;
}

#content {
    position: relative;
    height: 100%;
    min-height: 100%;
}

footer#colophon {
    position: absolute;
    bottom: 0;
}
Lyndi
  • 3
  • 4
  • **Do not just post a link to your site**. Since it's _already fixed_, this question now has zero value to future vistitors. **Height 100% does not** do what you think it does: https://stackoverflow.com/questions/7049875/height-100-not-working – random_user_name Feb 06 '18 at 20:13
  • you are messing up your height – Gerardo BLANCO Feb 06 '18 at 20:19
  • Sorry, I'm new to Stack Overflow - I will update my question to include the actual HTML so the question doesn't become useless. I did add a height of 100% to html as the linked post mentions, and that still doesn't seem to resolve anything, unfortunately. – Lyndi Feb 06 '18 at 20:21

1 Answers1

1

Your main problem is that .consumer-page is getting a position:absolute and its messing with your elements heights

Lets try the next classes:

.consumer-page {
    min-width: 100%;
    margin: 0 auto;
    position: initial;
    left: 0;
    top: 0;
}

.wrap {
    padding: 0;
    width: 100vw;
    max-width: 100vw;
    margin: 0;
}

#content {
    padding: 0;
}


footer#colophon {
    position: initial;
    bottom: 0;
}

Hope this helps. If you run into problems, pliss coment on this answer and will happily edit

Gerardo BLANCO
  • 5,590
  • 1
  • 16
  • 35