【问题标题】:Wordpress: White space below footerWordpress:页脚下方的空白
【发布时间】:2019-02-20 16:53:02
【问题描述】:

我的 WP 网站上的 4 个网页中有 2 个出现问题。

我的页脚下方有一个空格。我试过 position: fixed;和底部:0;..但它不工作。

我现在有点卡住了。

PHP 代码

<?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 */
?>

这是联系页面的css代码

.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

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

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

【问题讨论】:

  • 你能给我们展示一些小提琴或工作示例吗?
  • 向我们显示您遇到问题的实时链接,以便我们提供帮助。
  • webso.se/wordpress/kontakt Kontakt 和 Referenser 是有问题的页面

标签: php css wordpress


【解决方案1】:

您需要将页脚定位到absolute 并在底部为body 标签提供200px 的内边距,如下所示:

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;
}

【讨论】:

    猜你喜欢
    • 2018-12-12
    • 1970-01-01
    • 2016-08-09
    • 1970-01-01
    • 2014-10-04
    • 1970-01-01
    • 2013-09-16
    • 2013-05-09
    • 1970-01-01
    相关资源
    最近更新 更多