所有网页的通用页脚

时间:2016-08-02 20:23:53

标签: html css footer

我有一个网站,我需要为所有页面都有一个共同的页脚。然而,页面内容各不相同,很少页面具有较少的主体,很少有可滚动的主体。但我的页脚并没有为所有页面保持不变。我需要它在所有页面的底部(在正文之后)。我尝试了多种使用CSS,javascript,jquery的方法,但它们只适用于一个页面而不是一起使用。

有人可以帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

我也在努力解决这个问题!我了解到关键是要有一个包装器ID:

html:

<html>

<body>
<div id="wrapper">


<div class="content">

<p> This is the content! </p>

</div> <!-- content -->



<footer>

<p> This is the footer!!! </p>

</footer>

<div> <!--#wrapper-->

</body>

</html>  

<强>的CSS:

html {
height:100%;
}


body {
height:100%; 
}

#wrapper{
min-height:100%;
position: relative;
}

footer{
position:absolute;
bottom:0px;
background-color: black;
color: white;
width:100%;
padding-top: 25px;
padding-bottom: 25px;
text-align:center;

}