0

私はCSSをいじっていますが、それでも何らかの理由で「スティッキーフッター」を機能させることができません。

十分なコンテンツがない場合、フッターは正しく機能し、下部に留まりますが、コンテンツが多い場合、最後の100ピクセルは、本来あるべきではないときに常にフッターの後ろにあり、その理由がわかりません。

何が起こるかを確認するには、http://hevvo.eu/~dev/backtrack/index.phpにアクセスしてください。

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

4

4 に答える 4

2

CSS-tricksから:http://css-tricks.com/snippets/css/sticky-footer/

CSS:

* { margin:0; padding:0; } 

html, body, #wrap { height: 100%; }

body > #wrap {height: auto; min-height: 100%;}

#main { padding-bottom: 150px; }  /* must be same height as the footer */

#footer { 
    position: relative;
    margin-top: -150px; /* negative value of footer height */
    height: 150px;
    clear:both;
} 

/* CLEAR FIX*/
.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
.clearfix {
    display: inline-block;
}
/* Hides from IE-mac \*/
* html .clearfix { height: 1%;}
.clearfix { display: block;}
/* End hide from IE-mac */

HTML:

<div id="wrap">

    <div id="main" class="clearfix">

    </div>

</div>

<div id="footer">

</div>
于 2012-10-10T17:12:10.840 に答える
1

これについてはたくさんの記事があります。私のお気に入りは:

http://www.cssstickyfooter.com/using-sticky-footer-code.html

于 2012-10-10T17:12:20.043 に答える
0

にを設定するのを忘れましpadding-bottom: (height-of-footer)px.wrapper。これを設定すると、問題なく動作します。すなわち:

.wrapper {
  min-height: 100%;
  background: #F7F4EB;
  padding-bottom: 100px;
}
于 2012-10-10T17:25:42.763 に答える
0

コンテンツの周りに新しいdivを追加し、padding-bottomを追加することで修正しました:100px; それに。

于 2012-10-12T12:22:42.640 に答える