このように、ページの下部に 1 行のテキスト (すべてのテキストを中央揃え) を配置できる固定フッターが必要です。
これは私の現在のコードです。
他のチュートリアルを使用してみましたが、うまくいきませんでした。
これどうやってするの?
このように、ページの下部に 1 行のテキスト (すべてのテキストを中央揃え) を配置できる固定フッターが必要です。
これは私の現在のコードです。
他のチュートリアルを使用してみましたが、うまくいきませんでした。
これどうやってするの?
Ryan Fait の sticky footerを使用することをお勧めします。純粋な CSS でやろうとしていることを達成できます。
HTML:
<div class="wrapper">
Content Here
<div class="push"></div>
</div>
<div class="footer"></div>
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 */
}
.footer { /* centers the text */
text-align: center; /* horizontal centering */
line-height: 142px; /* vertical centering; should be equal to the footer height */
}
フッター要素とその前の hr 要素を次のように変更してみてください。
<footer style="position:fixed; left:0px; right:0px; bottom:0px;
background:rgb(255,255,255); text-align:center;">
<hr>
<p>© Company 2012</p>
</footer>
これで問題は多かれ少なかれ解決すると思います。http://ryanfait.com/sticky-footer/のフッターとまったく同じようには機能しませんが、私があなたの質問を理解している限り、これはあなたが望むものです.
PS: もちろん、CSS は CSS ファイルに入れる必要があります。