粘性页脚和粘性背景合二为一。将背景图像的高度作为页脚高度,并确定您的内容需要与多少图片重叠。要让粘性页脚“消失”,请在主边距底部使用与页脚高度相同的数字。这是来自粘性页脚的原始设计的适度设计:http ://www.webcreationz.nl/de-ultieme-sticky-footer-code (抱歉网站是荷兰语)。
我只是想通了。我希望它会帮助某人。
HTML:
<div id="container">
<div id="main">text of your website</div>
<div id="spacer"></div>
</div>
<div id="footer"></div>
CSS:
html, body {
height: 100%;
}
#container {
width: auto; /* with number center with margin: 0 auto;*/
min-height: 100%;
height: auto !important;
height: 100%;
margin-bottom: -175px; /* height footer */
}
#main {
height: auto;
width: 618px;
float: right;
margin-top: 10px;
padding: 20px;
background-color: #FFF;
border: 1px solid #E1E4EC;
margin-bottom: -100px; /* overlap of 100 px into footer */
}
#spacer {
display: block !important;
height: 175px; /* height footer */
}
#footer {
clear: both;
height: 175px; /* height footer */
width: auto; /* with number center with margin: 0 auto;*/
background-image: url("images/plaatje jpg"; /* background picture */
background-repeat: no-repeat;
background-position: center bottom;
}