0

我已经使用了许多建议的方法来确保我的页脚保持在底部,但是当我重新调整窗口大小以使其更小时,页脚不会因为位置而被推离页面:固定;我正在使用,但否则它不会以正常大小停留在页面底部,因为内容不会填满整个页面。

你能帮我吗?

编辑:CSS

html, body {
        margin:0;
        padding:0;
        height: 100%;
}

#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;
    text-align: center;
    height: 4em;



}

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 id="push"></div>
</div>
<p></p>
    <footer>
        <p>&copy;2013 Built by Rob **</p>
        <p>Designed by Akash ** &amp; Rob **</p>
    </footer>
</body>

4

2 回答 2

0

这是您的解决方案。使用粘性页脚。在您的代码中包含以下 css 文件

* {
     margin: 0;
    }
  html, body {
       height: 100%;
    }
    .wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -4em;
    }
    .footer, .push {
    height: 4em;
    }

希望它会帮助你。这里还有一个链接以获取更多详细信息 链接

于 2013-08-01T12:49:24.340 回答
0

你没有粘贴你的代码或给我们一个 jsfiddle,所以这就是我认为你应该做的。

在您的 CSS 中,使用媒体查询并根据屏幕宽度更改页脚的显示方式。

人像平板电脑

@media (min-width: 481px) and (max-width: 768px)

景观智能手机

@media (min-width: 321px) and (max-width: 480px)

人像智能手机

@media (max-width: 320px)

使用这些,设置:

#footer{
    position:whatever you want;
}

仅供参考,您不受这些尺寸的限制,这些只是常见的,您可以根据需要自定义它们。

于 2013-08-01T12:53:46.307 回答