无法在页面上水平拉伸页脚

时间:2015-09-15 14:59:43

标签: html css twitter-bootstrap

我对网络开发相当陌生,我试图在我的网站上横向拉伸页脚部分,但它却显示为一个框。我一再尝试改变代码的每个div的背景但是事情没有成功。作为故障排除步骤,我还尝试了this。我正在使用Bootstrap。 enter image description here

这是我的 HTML

    <div role="navigation" style="background-color: blue">
        <div class="container">
            <footer class="container-fluid" id="contact" style="width: 100%;">      
                <div class="row">
                    <div class="col-md-12">
                        <h2>Contact Us</h2>

                        <div class="row">
                            <div class="col-md-2"></div>
                            <div class="col-md-8 boxes">
                                <div class="contact-box">
                                    <div class="contact-icon pull-left"><i class="fa fa-map-marker fa-fw"></i></div>
                                    <div class="contact-details pull-left">
                                        <a href="#">221 Baker Street</a>
                                    </div>
                                </div>
                                <div class="contact-box extra-left-padding">
                                    <div class="contact-icon pull-left"><i class="fa fa-mobile fa-fw"></i></div>
                                    <div class="contact-details pull-left">
                                        <a href="mailto:fun@funny.nl">fun@funny.nl</a><br />
                                        <a href="tel:0000-0000-0000">000-000-000</a>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-2"></div>
                        </div>
                        <span class="copyright">&copy; Hello!</span>
                    </div>
                </div>      
            </footer>
        </div>
    </div>  

我的 CSS:

footer {
    background-color: #002776;
    padding-top: 80px;
    padding-bottom: 80px;
    text-align: center;
    color: #F0F0F0;
    font-weight: 300;
    font-size: 14px;
}
footer h2 {
    margin: 0 0 40px;
    font-weight: 400;
}
footer div.boxes {
    text-align: center;
}
footer div.contact-box {
    display: inline-block;
    margin-bottom: 40px;
    width: 280px;
    vertical-align: top;
}
@media screen and (max-width: 767px) {
    footer div.contact-box {
        width: 90%;
    }
}
footer div.contact-box.extra-left-padding {
    padding-left: 80px;
}
@media screen and (max-width: 767px) {
    footer div.contact-box.extra-left-padding {
        padding-left: 0;
    }
}
footer div.contact-box div.contact-icon {
    background-color: #0038a9;
    padding: 6px;
    margin: 0 20px 20px 0;
    text-align: center;
    font-size: 2em;
}
footer div.contact-box div.contact-details {
    text-align: left;
    line-height: 1.75em;
}
@media screen and (max-width: 767px) {
    footer div.contact-box div.contact-details {
        font-size: 12px;
    }
}
footer span.contact-link {
    display: inline-block;
    padding: 0 10px 70px;
}
footer a {
    color: #F0F0F0;
}
footer a:hover {
    color: #00a1de;
}
footer span.copyright {
    color: #999;
    display: block;
    text-align: center;
    font-size: 14px;
}
footer span.copyright img {
    max-width: 75px;
    position: relative;
    top: -2px;
}

1 个答案:

答案 0 :(得分:1)

HTML代码必须是: Css很好。

<footer class="container-fluid">      
                <div class="row">
                    <div class="col-md-12">
                        <h2>Contact Us</h2>

                        <div class="row">
                            <div class="col-md-2"></div>
                            <div class="col-md-8 boxes">
                                <div class="contact-box">
                                    <div class="contact-icon pull-left"><i class="fa fa-map-marker fa-fw"></i></div>
                                    <div class="contact-details pull-left">
                                        <a href="#">221 Baker Street</a>
                                    </div>
                                </div>
                                <div class="contact-box extra-left-padding">
                                    <div class="contact-icon pull-left"><i class="fa fa-mobile fa-fw"></i></div>
                                    <div class="contact-details pull-left">
                                        <a href="mailto:fun@funny.nl">fun@funny.nl</a><br />
                                        <a href="tel:0000-0000-0000">000-000-000</a>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-2"></div>
                        </div>
                        <span class="copyright">&copy; Hello!</span>
                    </div>
                </div>      
            </footer>