0

スティッキー フッターを機能させようとしていますが、現在次の CSS を試しています。

 #footer {
        width:920px;
        height:208px;
        font-size:10px;
        margin-left:auto;
        margin-right:auto;
        background-image:url(images/grad.png);
        background-repeat:repeat-y;
        padding:0 20px;
        clear:both;
        position:relative;
        margin-top:-208px;
 }

 body {
        margin:0;
        font-family:Arial, Helvetica, sans-serif;
        font-size:13px;
        color:#333333;
        background-repeat:repeat-x;
        padding: 0;
        height: 100%;
 }

 #wrap {
        width:960px;
        margin:0 auto;
        min-height:100%;
        height: 100%;
 }


    #content {
        width:892px;
        float:left;
        border-left:4px solid white;
        border-right:4px solid white;
        padding:15px 0px 15px 20px;
        background-image:url(images/sidebar_bg.png);
        position:relative;
        padding-bottom:143px;
    }

#content padding-bottom を減らす必要があったので、収まります。しかし、私はまだ問題を抱えています。まず、長いページの下部にスペースが多すぎます (参照 - http://bellbird.redgraphic.co.uk/headteacher/ ) 第二に、短いページでは、ブラウザー ウィンドウのサイズが変更されたときにフッターがスクロールアップしません (参照) - http://bellbird.redgraphic.co.uk/school-council/ )

スティッキー フッターは常に問題のように見えるので、トリックを見逃しているに違いありません。

どんな助けでも大歓迎です。

ルイス

4

3 に答える 3

2

便利なリンクはこちら。これは同じ問題で私を助けました。

CSS マークアップ:

html,
body {
   margin:0;
   padding:0;
   height:100%;
}
#container {
   min-height:100%;
   position:relative;
}
#header {
   background:#ff0;
   padding:10px;
}
#body {
   padding:10px;
   padding-bottom:60px;   /* Height of the footer */
}
#footer {
   position:absolute;
   bottom:0;
   width:100%;
   height:60px;   /* Height of the footer */
   background:#6cf;
}

HTML マークアップ:

<div id="container">
   <div id="header"></div>
   <div id="body"></div>
   <div id="footer"></div>
</div>
于 2013-05-08T12:12:59.217 に答える
0

あなたの代わりにこのcssを使用してください

#footer {
   position:fixed;
   bottom:0;
   left:0;
   right:0;
   height:40px;   /* Height of the footer */
   background:#6cf;
}
于 2013-05-08T12:15:39.887 に答える
0

html:

<div class="wrap">
  <div class="inner-wrap">
  ...
  </div>
</div>
<footer>
...
</footer>

CSS:

html, body {height:100%;}
.wrap {min-height:100%; height:auto !important; margin-bottom:-100px;}
.inner-wrap {padding-bottom:100px;}
footer {height:100px;}
于 2013-08-13T16:06:49.593 に答える