douyanzhou1450 2016-06-22 03:44
浏览 117
已采纳

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

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部