ページに 300 ピクセル程度のコンテンツがあまりない場合、フッターは解像度 1024 でページの中央に表示されます。
フッターの高さを知らずにフッターをページの下部に表示するにはどうすればよいですか?
私はこの解決策を試しました:
/* css */
html, body {
height: 100%;
}
#container {
min-height: 100%;
position: relative;
}
#footer {
position: absolute;
bottom: 0;
}
<!-- html -->
<html>
<head></head>
<body>
<div id="container">
<div id="footer"></div>
</div>
</body>
</html>
padding-bottom: (footerheight);
しかし問題は、#footer の前に要素を追加する必要があることです。フッターの高さはページによって可変なので、これは不可能です...