Placing footer under content doesn't seem to work

偶尔善良 提交于 2019-12-13 04:07:58

问题


I'm trying to get the footer on a webpage under my content, regardless of the length of the content. For some reason, it doesn't want to.

HTML:

<div class="container">
    <div class="navigatie">
        <ul>
            <a class="navigatielink" href="index.php?page=home"><li class="navigatieli navigatie1">Home</li></a>
            <a class="navigatielink" href="index.php?page=info"><li class="navigatieli navigatie2">Info</li></a>
            <a class="navigatielink" href="index.php?page=agenda"><li class="navigatieli navigatie3 ">Agenda</li></a>
            <a class="navigatielink" href="index.php?page=fotos"><li class="navigatieli navigatie4">Foto's</li></a>
            <a class="navigatielink" href="index.php?page=contact"><li class="navigatieli navigatie5">Contact</li></a>
            <a class="navigatielink" href="index.php?page=gastenboek"><li class="navigatieli navigatie6">Gastenboek</li></a>
        </ul>
    </div>
    <?php
        //include the page content
        include_once ("content/".$_PAGE.'.php');
    ?>
</div>
<div class="clear"></div>
<div class="footer">

CSS:

.container {
    width: 1000px;
    margin: auto;
    height: auto;
}

.clear {
    clear: both;
}
.footer {
    background-image: url("images/css/footer.png");
    height: 500px;
}

.navigatie {
    font-family: Rockwell;
    height: 45px;
    width: 980px;
    margin:auto;
    margin-top: 15px;
    font-size: 24px; 
    border: 1px solid #c3c3c3;
    background: #fff;
}

I already tried to give the .container a height of 100% and played with positioning, but I don't seem to be able to get this footer under the content regardless of the length of it...
Any more suggestions?

EDIT:
It's about this website


回答1:


As you have not mentioned the style which has been used for class="navigatie" I guess you have used float property there. If so then add overflow:hidden to .container. For e.g.,

.container {
    width: 1000px;
    margin: auto;
    height: 100%; /* For IE6 */
    overflow:hidden /* For all other browsers*/
}

If my assumption is not right, then please provide the full list of elements present inside .contaier and also the full stylesheet.

EDIT: Try this

 HTML:
   <div class="contentPart">
      <?php
        //include the page content
       include_once ("content/".$_PAGE.'.php');
      ?>
 </div>

CSS:
.contentPart {
     overflow:hidden;
     height:100%;
}



回答2:


try adding a float:left; to .footer class

.footer{
  float:left;
}

if you can get a jsFiddle up it'll help massively



来源:https://stackoverflow.com/questions/11079749/placing-footer-under-content-doesnt-seem-to-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!