-1

スクロールしているときでも、ブラウザ画面の下部にdivを保持するように設定するにはどうすればよいですか?

4

5 に答える 5

6

次のdivがあるとします

<div class="footer">This is at the bottom</div>

次のCSSを使用して、ビューポートの下部に固定することができます

.footer {
  position: fixed;
  bottom: 0;
}

スクロールしてもそこにとどまります。

于 2012-12-13T10:59:35.703 に答える
4

position: fixedそれに接続されているCSSのプロパティを使用しますdiv

#footer {
    position:fixed;
    bottom:0;
}
于 2012-12-13T11:02:09.757 に答える
1

このCSSを試してみてください:

* {
    margin: 0;
}
html, body {
    height: 100%;
}
.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
    height: 142px; /* .push must be the same height as .footer */
}

CSSソース: http: //ryanfait.com/sticky-footer/

于 2012-12-13T11:00:13.260 に答える
0

スティッキーフッターの実装

ご覧ください

http://css-tricks.com/snippets/jquery/jquery-sticky-footer/

于 2012-12-13T11:00:38.623 に答える
0

に優れたフッターチュートリアルがあります

http://www.lwis.net/journal/2008/02/08/pure-css-sticky-footer/

デモページはこちらです:

http://www.lwis.net/profile/CSS/sticky-footer.html

基本的な前提は、本体ページがページの100%に引き伸ばされることです。最小の高さも100%です。

次に、フッターには次のルールが与えられます。

#footer {
 clear: both;
 position: relative;
 z-index: 10;
 height: 3em;
 margin-top: -3em;
}

私はこれから答えを得まし

于 2012-12-13T11:06:39.327 に答える