在css中创建一个页脚块

时间:2013-08-22 14:02:48

标签: html css footer

我正在为我的网站创建一个页脚块。我不是css的专家。我期待在左侧和右侧创建一个带填充的块。

附件是页脚块的示例,我希望创建:enter image description here

但是,我创建的页脚块跨越整个屏幕。知道什么可能是错的吗?

这是我的css代码:

#footer-row1{
    margin-top: 80px;
    padding: 1.2em 0;
    background: #000;
    bottom: 0;
    margin-right: -33px;
    font-family: "Fjalla One", Verdana, Geneva, sans-serif;
    font-size: 0.95em;
    text-transform: uppercase;
}

这是footer.html代码

<div id="footer-row1">
                    <div id="footer-bg">
                        <div id="footer" class="container_24">
                            <div class="copyright">
                              #COPYRIGHT#&COPY;{var name='copyright_year'} {var name='sitename'}. &nbsp;&nbsp;{var name='footer_menu'}
                          </div>
                        </div>
                    </div>
                </div>

由于

3 个答案:

答案 0 :(得分:3)

检查此 FIDDLE

 #footer-row1{
    margin-top: 80px;
    padding: 1.2em 0;
    background: #000;
    bottom: 0;
    margin-right: -33px;
    font-family: "Fjalla One", Verdana, Geneva, sans-serif;
    font-size: 0.95em;
    text-transform: uppercase;

}

.copyright{
    text-align: center;
    color: #FFF;
}

答案 1 :(得分:1)

根据我对上述内容的理解,您可以减少很多并从图像中获取页脚。所有你真正需要的是:

CSS

footer {
    padding: 1.2em 0;
    background: #000;
    font-family: "Fjalla One", Verdana, Geneva, sans-serif;
    font-size: 0.95em;
    text-transform: uppercase;
    text-align:center;
    /* you probably need to add some extra styles here */
}

HTML

<div class="footer">
    #COPYRIGHT#&COPY;{var name='copyright_year'} {var name='sitename'}. &nbsp;&nbsp;{var name='footer_menu'}
</div>

这会在内容的底部放置类似图像的内容。

答案 2 :(得分:0)

css:

#footer-row1{
        margin-top: 80px;
        padding: 1.2em 0;
        background: #000;
        bottom: 0;
        margin-right: -33px;
        font-family: "Fjalla One", Verdana, Geneva, sans-serif;
        font-size: 0.95em;
        text-transform: uppercase;

    //add
        text-align: center;
        display: block;
        width: 100%;
        clear: both; //because you have some float on the previous "row"

    }

并添加:

 #footer-row1 a{ //for you link
        font-family: "Fjalla One", Verdana, Geneva, sans-serif;
        font-size: 0.95em;
        text-transform: uppercase;
        color: #3399FF; //blue for example
    }

    #footer-previousRow{ //the previous row with list items
        display: block;
        width: 100%;
        height: 260px;
    }

    #footer-previousRow ul.listItem{
        list-style: none;
        list-style-type: none;
        min-height: 36px;
        margin: 0;
        overflow: hidden;
        display: block;
        float: right;
    }

    ul.listItem li{
       color: #CCCCCC;
    }

以及之前版本的html代码:

<div class="footer-previousRow">
    <ul class="listItem">
        <li>Contact</li>
        <li>Social</li>
    </ul>
</div>

<div id="footer-row1"> // your actual code
                    <div id="footer-bg">
                        <div id="footer" class="container_24">
                            <div class="copyright">
                              #COPYRIGHT#&COPY;{var name='copyright_year'} {var name='sitename'}. &nbsp;&nbsp;{var name='footer_menu'}
                          </div>
                        </div>
                    </div>
                </div>