gpt4 book ai didi

php - WordPress:页脚下方的空白

转载 作者:行者123 更新时间:2023-11-28 05:39:45 25 4
gpt4 key购买 nike

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

我的页脚下方有一个空白。我试过 position: fixed;和 bottom: 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;
}

最佳答案

您需要将页脚定位到 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;
}

关于php - WordPress:页脚下方的空白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37967079/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com