私は何も変更せずにブートストラップを使用しています。レイアウトはとてもシンプルです。私はトップナビゲーションバーを持っています。続いてメインコンテナ。最後に、フッターがあります。何かのようなもの:
<head>
<style>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
background-color: #ECECEC;
}
</style>
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
// navbar elements
</div> <!-- end of class navbar -->
<div class="container">
// fluid-row class with two column structure
</div> <!-- end of class container -->
<div class="footer">
<div class="container"> <!-- using container to left-align footer to the main content -->
// some content
</div> <!-- end of class footer -->
</body>
できないことが2つあります。
1) メイン コンテナ クラスのコンテンツが少ない場合は常に、フッターを画面の下部に配置する必要があります。min-height:100% を試しましたが、何か間違っています。
2) フッターの背景色を変更する必要があり、メイン コンテナーが終了したら、フッターが画面の残りの部分を占める必要があります。フッターには最小の高さを設定するか、フッター内のコンテンツに従って高さを設定できます。
.footer {
height:80px;
margin-top:-80px;
position:relative;
clear:both;
padding-top:20px;
background-color:#F4F4F4;
border-top:1px solid #ddd;
clear:both;
}
何が起きてる?
JSfiddle: http://jsfiddle.net/m7dkt/13/