2

div.bottomページの下部に高さ 100pxの a を表示する方法。コンテンツの高さがウィンドウの高さよりも小さい場合、ウィンドウのdiv.bottom下部に表示されます。コンテンツの高さがウィンドウの高さより大きい場合、ページの下部に表示されます。

4

5 に答える 5

2

Do you need something like this?

<div style="position:absolute; bottom:0;">Hi</div>

http://jsbin.com/ayaqo4

于 2011-02-01T15:11:04.360 に答える
1

あなたが話しているのはスティッキーフッターと呼ばれ、htmlとcssだけで実行できます。基本的な考え方は、負のマージンのあるラッパーを使用してheights: 100%、最下部より上に移動することです。こことここからコードスニペットを盗んだ

<body>
    <div class="wrapper">content here!
         <div class="push"></div>
    </div>

    <div class="footer">footer content</div>
</body>

* {

    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 */
  }
于 2011-02-01T15:14:31.443 に答える
1

スティッキー フッターの個人的なお気に入りは次のとおりです。

http://www.cssstickyfooter.com/

于 2011-02-01T15:57:37.487 に答える
0

cssを使用する必要があります。

div.pos_fixed_footer{
    position:fixed;
    bottom:0%;
    right:0px;
    background:transparent url(../img/bg_header.png) repeat scroll center top;  
    width:100%;
    height:40px;
}

次に、このようにスクリプトを呼び出します

<div id="pos_fixed_footer"><?php include "footer.html"; ?></div>
于 2011-02-01T15:13:47.090 に答える
0

コンテンツがウィンドウからはみ出さない場合にのみ、ウィンドウの下部にあるフッターを意味していると思います。それ以外の場合は、ページを下に移動する必要があります。

ここからコードを実装するだけですhttp://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page

于 2011-02-01T15:30:07.420 に答える