首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的页脚不会保持固定- Wordpress

我的页脚不会保持固定- Wordpress
EN

Stack Overflow用户
提问于 2012-12-17 06:03:29
回答 4查看 2.6K关注 0票数 1

我正在为一个朋友做很多关于wordpress主题的修改。我有很多关于页脚停留在页面底部的问题,而不是一直向上移动并留下空格。

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

HTML (footer.php)

代码语言:javascript
复制
<?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

代码语言:javascript
复制
#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;  }

我希望在你的帮助下我能查个水落石出。约翰

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2012-12-17 06:29:51

通过遵循这个小教程,我设法解决了我的问题:

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

该链接归功于mfreitas。

还有,向在这件事上帮助过我的其他人致以问候。谢谢约翰

票数 1
EN

Stack Overflow用户

发布于 2012-12-17 06:07:56

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

代码语言:javascript
复制
#content {
min-height: 700px;
}

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

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

票数 1
EN

Stack Overflow用户

发布于 2012-12-17 06:05:22

使用position: fixed;

使用此CSS更新您的代码:

代码语言:javascript
复制
#footer {position: fixed;}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13905905

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档