1

我正在为一个朋友对 wordpress 主题进行大量修改。我有很多关于页脚停留在页面底部的问题,而不是不断向上移动并留下空白。

网址: http ://design.jarethmusic.com/about/

HTML (页脚.php)

<?php global $woo_options; ?>
    <?php
        $total = 4;
        if ( isset( $woo_options['woo_footer_sidebars'] ) ) { $total = $woo_options['woo_footer_sidebars']; }
        if ( ( woo_active_sidebar( 'footer-1' ) ||
               woo_active_sidebar( 'footer-2' ) ||
               woo_active_sidebar( 'footer-3' ) ||
               woo_active_sidebar( 'footer-4' ) ) && $total > 0 ) {

    ?>

    <div id="footer-widgets">
        <div class="col-full col-<?php echo $total; ?>">

        <?php $i = 0; while ( $i < $total ) { $i++; ?>
            <?php if ( woo_active_sidebar( 'footer-' . $i ) ) { ?>

        <div class="block footer-widget-<?php echo $i; ?>">
            <?php woo_sidebar( 'footer-' . $i ); ?>
        </div>

            <?php } ?>
        <?php } ?>

        <div class="fix"></div>
        </div>
    </div><!-- /#footer-widgets  -->
    <?php } ?>
<div class="push"></div>
    <div id="footer">
        <div class="col-full">

        <div id="copyright" class="col-left">
        <?php if( isset( $woo_options['woo_footer_left'] ) && $woo_options['woo_footer_left'] == 'true' ) {

                echo stripslashes( $woo_options['woo_footer_left_text'] );

        } else { ?>
            <p><?php bloginfo(); ?> &copy; <?php echo date( 'Y' ); ?>. <?php _e( 'All Rights Reserved.', 'woothemes' ); ?></p>
        <?php } ?>
        </div>

        <div id="credit" class="col-right">
        <?php if( isset( $woo_options['woo_footer_right'] ) && $woo_options['woo_footer_right'] == 'true' ) {

            echo stripslashes( $woo_options['woo_footer_right_text'] );

        } else { ?>
            <p><?php _e( 'Powered by' ); ?> <a href="http://www.wordpress.org">WordPress</a> and <a href="http://www.woothemes.com">WooThemes. </a> <?php _e( 'Designed and edited by' ); ?> <a href="http://johns-webdesign.com/">John Brown.</a></p>
        <?php } ?>

        </div></div>
    </div><!-- /#footer  -->
</div><!-- /#wrapper -->
<?php wp_footer(); ?>
<?php woo_foot(); ?>
</body>
</html>

CSS

#footer{padding: 30px 0 20px; background: url(images/bg-ripple-footer.png) repeat top left; color:#999;}
#footer p {}
#footer a { color: #ffffff; }
#footer #credit img{vertical-align:middle;}
#footer #credit span{display:none;}

#footer-widgets { margin-bottom: -5px; background: url(images/bg-ripple-footer-widgets.png) repeat top left; padding:10px 0; height:60px; }
#footer-widgets .block { padding:20px 10px 0 10px; float:left; }
#footer-widgets .col-1 .block { width:100%; padding-left:0; }
#footer-widgets .col-2 .block { width:420px; padding-left: 20px; }
#footer-widgets .col-3 .block { width:270px; padding-left: 16px;  }
#footer-widgets .col-4 .block { width:200px; padding-left: 10px;  }

我希望我能在你的帮助下彻底解决这个问题。约翰

4

4 回答 4

1

不要在你的 CSS 中添加这个:

#content {
min-height: 700px;
}

您需要内容区域的最小高度才能将页脚“推”到页面底部。如果内容区域是包装器内部的一小部分,页脚将不会位于页面底部。

旁注:一个非常有用的工具是使用 Chrome 浏览器。它有一个内置的类似萤火虫的扩展,可以让您在更新网页的同时检查网页元素。

于 2012-12-16T22:07:56.207 回答
1

按照这个小教程设法解决了我的问题:

http://mystrd.at/modern-clean-css-sticky-footer/

归功于 mfreitas 的链接。

另外,关于在这方面帮助过我的其他人。谢谢约翰

于 2012-12-16T22:29:50.907 回答
0

采用position: fixed;

使用此 CSS 更新您的代码:

#footer {position: fixed;}
于 2012-12-16T22:05:21.650 回答
0

position: absolute;在您的 CSS 中用于页脚

于 2012-12-16T22:13:20.680 回答