0

我有一个页脚,我想一直留在页面底部,但是当内容填满页面时,页脚不会向下移动,它只是悬停在文本上。问题是内容仅开始在小窗口和低分辨率显示器上滚动。所以我需要页脚留在页面底部没有填充的内容,然后在窗口很小时被内容推出

图片:http: //imgur.com/oS7HBUc - 页脚悬停在内容上而不是被向下推,但滚动条出现并且当我滚动时页脚停留在那里

这是我的CSS:

`
html, body {
        margin:0;
        padding:0;
}

#container {
}

#spacer {
        height: 10px;
        background-color: #24246B;
}

@font-face {
        font-family: palatino;
        src: url('font/palatino.ttf');
}

@font-face {
        font-family: footer;
        src: url('font/footer.ttf');
}

.fb_widget {
    float: right;
    margin-right: 10px;
}

#header, #nav, article, section, body, #mail_success {
        font-family: palatino;
}


#header {
    margin-top: 1%;
    text-align: center;


/*  font-size: 60px;
    color: #F2E6FF;
    border: solid #24246B;
    background-color: #24246B;
    width: 25.5%;
    border-right-color: #4610B3;
    border-right-width: 25px;
    border-left-width: 15px;
    margin-top: 2%;
    text-align: right;*/
}


#nav ul {
    margin-top: 2%;
    line-height: 30px;
    font-size: 17px;
    text-align: center;
    background-color: #24246B; 
}

#nav ul li {
    display: inline;
}

#nav ul li a {
    text-decoration: none;
    color: #F2E6FF;
    padding: 7px 2% 6px 2%;
    font-weight: bold;
    border-radius: 20%;

    /* This makes it fade colour*/
    -o-transition: .5s;
    -ms-transition: .5s;
    -moz-transition:. 5s;
    -webkit-transition: .5s;
    transition: .5s;
}

#nav a:hover {
    color: #24246B;
    background-color: #F2E6FF;
    border-radius: 20%;
}

body {
    background-image: url('media/bg.png');
    padding-bottom: 60px;
    height: 100%;
    max-height: 100%;

}

article {
    color: #24246B;
    margin-left: 20%;
    margin-right: 20%;
    font-size: 20px;
    font-weight: bold;
}

section {
    font-weight: normal;
    font-size: 15px;
    text-align: justify;
    padding-left: 2%;
}

form {
    padding-left: 7%;
    font-size: 19px;
}

input {

    height: 25px;
    width: 300px;
    font-size: 14px;

}

.contact_submit {
    width: 110px; 
    margin-right: 50%;
    margin-left: 42%;
}

label {
    text-align: right;
    float: left;
    display: block;
    width: 260px;
    font-weight: bold;
}

label:after {
    content: "..";
    color: transparent;
}

#push {
    height: 4em;
}

footer {
    font-family: footer;
    color: #cccccc;
    font-size: 8px;
    text-transform: uppercase;
    font-style: italic;
    position: absolute;
    bottom: 0px;
    width: 100%;
}

footer p{
    text-align: center;

}

footer:hover {

    /* This makes it transition*/
    -o-transition: .5s;
    -ms-transition: .5s;
    -moz-transition:. 5s;
    -webkit-transition: .5s;
    transition: .5s;
    color: #24246B;
    font-size: 12px;
}

#mail_success {
    text-align: center;
    padding: 7%;
    font-size: 17px;
    font-weight: bold;
}

@media screen and (max-device-width: 640px) {
    #logo {
        display: none;
    }
}'

和页脚的 HTML:

'   </div>
    <p></p>
        <footer>
            <p>&copy;2013 Built by Rob Calcroft</p>
            <p>Designed by Akash Bharadia &amp; Rob Calcroft</p>
        </footer>
    </body>
</html>

'

4

1 回答 1

0

在你的 html 中你有<footer>和 cssfooter{ some-code}

这不应该是 id(如果每页使用一次 onyl)或类(如果每页使用多次)吗?

.footer

或者

#footer

然后

<div id="footer">text</div>
于 2013-08-01T15:40:04.063 回答