mackeemackee mackeemackee - 5 months ago 16
PHP Question

Wordpress: White space below footer

I got a problem with 2 out of 4 webpages on my WP site.

I got a whitespace below my footer. I've tried with position: fixed; and bottom: 0;.. But its not working.

Im kind of stuck right now.

PHP Code

<?php
/* Template Name: Contact_page */
get_header(); /* HÄMTA HEADER */
?>

<?php
$args = array( 'post_type' => 'employe', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>

<section class="contact_section">

<article>
<?php the_content(); ?>
<?php the_post_thumbnail();?>
</article>
</section>
<?php
endwhile;
?>

<?php
get_footer(); /* HÄMTA FOOTER */
?>


Here is the css code for the contact page

.contact_section{
margin: auto;
max-width: 60%;
margin-top: 40px;
}


.contact_section article {
margin-top: 20px;
width: 60%;
margin:auto;
}

.contact_section p {
float: left;
font-size: 1.8em;
}

.contact_section img{
margin-left: 20px;
}


CSS for footer

footer {
clear: both;
text-align: center;
bottom: 0;

background-color: #444444;
height: 200px;
padding-top: 30px;
padding-bottom: 10px;
}

Answer

Position the footer absolute and give the body tag 200px padding at the bottom.

body {
  /* 200px for the footer and 30px for the padding body */
  padding-bottom: 230px;
}

footer {
  position absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
}