나는 동적 인 높이 (성장하고있는 내용)가있는 div의 바닥에 끈적 인 바닥 글을 얻으려고 노력하고있다. div는 페이지 중앙에 떠 있어야합니다 (왼쪽과 오른쪽에서 같은 거리).HTML, CSS 끈끈한 footer (성장하는 내용)
나는 HTML 다음 (관련이없는 물건의 제거) 한 :
<html>
<body>
<div class="bodybackground">
<div class="container"><!-- floats in the middle -->
<div class="mainContainer"><!-- different color etc -->
<!-- content with dynamic height -->
</div>
<footer class="pagefooter"></footer>
</div>
</div>
</body>
</html>
다음과 같은 CSS는 (또한 관련이없는 물건의 제거) :
는html {
height: 100%;
margin: 0px;
padding: 0px;
}
body {
margin: 0px;
height: 100%;
}
.bodybackground {
height: 100%;
min-height: 100%;
}
.container {
min-height: 100%;
display: inline-block; /* needed make it float in the middle of body */
top: 0px;
position: relative;
padding: 0px;
padding-bottom: 158px; /* height of footer */
}
.mainContainer {
position: absolute;
height: 100%;
overflow: auto;
}
.pagefooter {
position: absolute;
bottom: 0px;
margin: 0px;
padding: 0px;
height: 158px;
}
그러나 mainContainer의 내용이 밖으로 수레 바닥 글이 맨 아래에있는 대신 바닥 글 뒤에서 계속됩니다. 컨테이너의 표시 속성을 변경하도록하는 예제를 제외하고는 모든 것을 시도해 보았습니다. 컨테이너를 중간에 띄우는 것이 필요했습니다.
내가 바보가되는 곳의 단서는 무엇입니까? 감사!!
.push를 사용하여 좀 더 많은 것을 연습해야했지만 문제가 해결되었습니다. 빠른 답변 주셔서 감사합니다!