底部粘滞的页脚

时间:2013-07-15 03:23:53

标签: css css3 html sticky-footer

我的页脚出现问题,它没有受到内容的推动,我已经尝试用绝对替代相对,但没有成功,我试图使用bottom:0;但它也没有用,这是我的css代码:

html, body {


width:100%;
min-height:100%;
background-image: url(../img/bg.png);
background-repeat: repeat;

}   

* {
margin: 0px;
padding: 0px;
}
a, img {
border:none;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
 }






#wrapper {
width: 1024px;
margin-right: auto;
margin-left: auto;
min-height: 100%;
position:relative;  
}


#foot {
width: 100%;
height:200px
position:absolute;
bottom:0;
background-image:url(../img/foot.png);
background-repeat:no-repeat;


}




#banner {
min-height: 100%;
margin:0;
 padding:0;
position: relative;
top: 24px;
background-image: url(../img/banner2.png);
background-repeat:no-repeat;
width:100%;
height:173px;

}


#navigation {
height: 60px;
position: relative;
left: auto;
width: 100%;
top: 23px;
margin: 0px;
padding: 0px;
z-index:1;
border: none;   
}

#categoria {
position: absolute;
width: 710px;
height: 240px;
z-index: 0;
left: -29px;
top:30px;
padding: 0px;
z-index:1;



}

.othergames{
position: absolute;
top: -13px;
width: 740px;
height: 251px;
background-image: url(../img/otherg.png);
background-repeat: no-repeat;
z-index:1;
left: -43px;


}

.othergames-back{
position: absolute;
top: -11px;
width: 730px;
height: 247px;
background-color:#FFF;
left: -37px;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;

}


#texto{
height: 10px;
text-align:center;
width: 50px;
margin: 0px;
padding: 0px;
left: 34px;
top: 243px;
}

#apDiv1 {
position: absolute;
left: -3px;
top: 3px;
width: 209px;
min-height: 100%;
z-index: -1;
margin: 0px;
padding: 0px;
}

#like {
position: relative;
left: -3px;
top: 550px;
width: 215px;
min-height: 100%;
z-index: -1;
margin: 0px;
padding: 0px;
}



#apDiv2 {
position: absolute;
left: 220px;
top: 60px;
width: 862px;
height: 482px;
z-index: 0;
padding: 0px;

}

#apDiv4 {
margin: 0;
padding: 0;
position: absolute;
left: -6px;
top: 90px;
width: 201px;
height: 499px;
z-index: 1;
}

和html代码:

 <div id="wrapper">
 <div id="banner"></div>

 <div id="navigation">








<div id="apDiv4">






 </div>



 <div id="fb-root"></div>

<div id="like">
<div class="fb-like-box" data-href="https://www.facebook.com/pages/Legend-of-Games/476628629090111" data-width="215" data-show-faces="true" data-stream="false" data-show-border="false" data-header="false"></div></div>



<div id="apDiv2">



   <script>
 (function($){
      $(window).load(function(){
        $("#apDiv2").mCustomScrollbar();


    });
 })(jQuery);
</script>

<div align="center" id="thumb">

<div id="screen_game">

<a href="legendofgames/gameview.php?recordID=<?php echo $row_GameData['idGames']; ?>">  <img style="border-radius:5px;border:thin solid #FFF;" src="../legendofgames/documentos/games/<?php echo $row_GameData['strImage']; ?>"  width="160" height="130"/></a>
<div align="center" id="gametext"><?php echo $row_GameData['strNome']; ?> </div>
</div>


</div>

<div id="apDiv1"><img src="../img/lateralb2.png" width="209" height="592"/>  



</div> 

</div>
</div>


<footer >
<div id="foot"></div>

</footer>

</body>    

2 个答案:

答案 0 :(得分:2)

由于您有一些不可用的背景图片和内容,因此我生成并将一些内容插入ID为<section>的{​​{1}}。正如您在the fiddle中看到的那样,我刚刚将页脚设置为container处的固定位置块元素,这意味着它始终位于底部。

CSS:

bottom: 0;

享受页面其他部分的乐趣!

答案 1 :(得分:1)

我认为您需要将您的职位更改为固定职位。

#foot {
width: 100%;
height:200px
position:fixed;
bottom:0;
background-image:url(../img/foot.png);
background-repeat:no-repeat;
}

我无法测试您的代码,但我能够使用类似的样式获得粘性页脚。