douyanzhou1450 2016-06-22 11:44
浏览 115
已采纳

Wordpress:页脚下方的空白区域

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;
}
  • 写回答

1条回答 默认 最新

  • dongliang1223 2016-06-22 12:09
    关注

    You need to position the footer to absolute and give the body tag a padding of 200px at the bottom, like this:

    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;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题