Cssでスティッキーフッターを作っています。思い通りにいかない。フッターは一番下にくっつきますが、ページの高さも 100% にしたいです。これはうまくいきません、そして私はたくさん試しました。現在、フッターがコンテナの邪魔になり、重なっています。containermargin-bottom: 70px;
を指定すると、コンテンツが非常に小さい場合に余分な不要なスペースが作成され、不要なスクロールバーが作成されます。
これが私のコードです:
<html><head>
<style type='text/css'>
body {
font-family: 'Open Sans', sans-serif;
font-size: 20px;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
.container {
margin-left: auto;
margin-right: auto;
text-align: left;
width: 800px;
height: auto !important;
min-height: 100%;
}
.bold-show {
font-family: Helvectica, sans-serif;
font-size: 96px;
background-color: rgba(0, 0, 0, 0.95);
color: #eeeeee;
padding: 50px;
}
#footer {
position: relative;
height: 70px;
width: 100%;
text-align: center;
display: table;
margin-top: -70px;
background-color: rgba(0, 0, 0, 0.9);
color: #eeeeee;
}
#footer div {
display: table-cell;
vertical-align: middle;
}
</style>
</head><body>
<div class='container'>
<div class='bold-show'>
Donuts. Food for thought. This is my place, this fox will guide you. Random filler text for the win.
</div>
</div>
<div id='footer'>
<div>
We support a free and open internet.
</div>
</div>
</body></html>
また、これは実際のサイトではありません。実際のサイトに実装するためのテストです。