如何将页脚和栏移动到页面底部

时间:2015-05-29 04:24:02

标签: css wordpress position

如何将页脚和页脚栏放到页面底部。目前它位于内容之下。

我需要它坐在页面的最底部。我正在使用悉尼主题WordPress。

我有一个全屏图像,并希望页脚穿过最底层。

.footer-widgets {
    padding: 5px 0;
    background-color: #252525;
}
.footer .copyr {
    color: #a8a8a8;
    margin-bottom: 0;
}
.footer-widgets .widget-title {
    text-transform: uppercase;
    color: #c5c5c5;
    line-height: normal;
    margin: 5px 0 0;
}

/* widget info */
.widget-info .logo-footer {
    margin-bottom: 5px;
}
.widget-info p {
    margin-bottom: 5px;
}
.widget-info .infomation {
    list-style: none;
    margin: 0;
}
.widget-info .infomation li {
    position: relative;
    padding: 0 0 0 30px;
    margin-bottom: 5px;
    line-height: 24px;
}
.widget-info .infomation li.address:before,
.widget-info .infomation li.phone:before,
.widget-info .infomation li.email:before {
    position: absolute;
    left: 0;
    top: 0;
    content: "\f041";
    font-family: "FontAwesome";
    font-size: 16px;
}
.widget-info .infomation li.phone:before {
    content: "\f095";
}
.widget-info .infomation li.email:before {
    content: "\f040";
}

/* widget links */
.widget-links ul {
    list-style: none;
    margin: 0;
}
.widget-links ul li {
    padding: 10px 0 7px;
}
.widget-links ul li:first-child {
    padding-top: 0;
}
.widget-mail-subscribe p {
    padding-bottom: 10px;
}
.widget-mail-subscribe .email-sub input {
    width: 205px;
    margin-bottom: 10px;
}

/*--------------------------------------------------------------
Bottom
--------------------------------------------------------------*/
img.wp-smiley,
img.emoji {
    background: rgba(0, 0, 0, 0) none repeat scroll 0 0 !important;
    border: medium none !important;
    box-shadow: none !important;
    display: inline !important;
    height: 1em !important;
    margin: 0 0.07em !important;
    padding: 0 !important;
    vertical-align: -0.1em !important;
    width: 1em !important;
    margin-bottom: 5px;
}
.site-footer {
    background-color: #1c1c1c;
    line-height: 35px;
    padding: 15px 0;
}
.site-footer,
.site-footer a {
    color: #666;
}
.site-footer .socials {
    margin: 0;
    list-style: none;
}
.bottom .socials li {
    display: inline-block;
    margin-left: 5px;
}
.site-footer .socials li a {
    display: inline-block;
    color: #666;
    font-size: 14px;
    background-color: #2e2e2e;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    -o-border-radius: 50%;
    border-radius: 50%;
}
.site-footer .socials li:hover a {
    color: #fff;
}

HTML

<?php
/**
 * The template for displaying the footer.
 *
 * Contains the closing of the #content div and all content after
 *
 * @package Sydney
 */
?>
            </div>
        </div>
    </div><!-- #content -->

    <?php if ( is_active_sidebar( 'footer-1' ) ) : ?>
        <?php get_sidebar('footer'); ?>
    <?php endif; ?>

    <a class="go-top"><i class="fa fa-angle-up"></i></a>

    <footer id="colophon" class="site-footer" role="contentinfo">
        <div class="site-info container">
        <footer>
            © Coffee Captain 2015.   This site is for educational purposes only.
        </footer>

        </div><!-- .site-info -->
    </footer><!-- #colophon -->
</div><!-- #page -->

<?php wp_footer(); ?>

2 个答案:

答案 0 :(得分:0)

尝试将此css添加到您的页脚

{
    clear: both;
    position: relative;
    z-index: 10;
    height: 3em;
    margin-top: -3em;
}

最好还发布你的html来解决你的问题(作为建议)

答案 1 :(得分:0)

没有HTML很难说有什么可以帮助。

我尝试了以下JSFiddle:

Link here

.site-footer {
        background-color: #1c1c1c;
        line-height: 35px;
        padding: 15px 0;
        position: absolute;
        bottom: 0px;
        width: 100%
    }

并创建了html:

<div class="site-footer">sample</div>

似乎是您正在寻找的。

或者如果您正在寻找始终位于容器元素底部的页脚:

.site-footer {
        background-color: #1c1c1c;
        line-height: 35px;
        padding: 15px 0;
        position: relative;
        bottom: 0px;
        width: 100%
    }