【发布时间】:2017-10-03 05:41:50
【问题描述】:
我正在尝试创建一个包含多个页面的网站。我正在使用服务器端包含在每个页面的标题和站点内容栏中转储,因此我不必在每个页面中都包含 HTML。
我到了想要包含页脚的地步,并且正在努力解决如何将页脚强制到页面底部,并尝试了很多在 Stack Overflow 上找到的建议,或者我遗漏了一些东西或者需要尝试不同的东西。
似乎没有考虑帮助内容的高度(使用 JQuery 手风琴)...?...或者我没有正确的格式来将页脚推到页面底部屏幕。
也许有更好的方法来完成我想要完成的工作(无需复制 HTML 即可为每个页面添加页眉和页脚),或者我缺少 HTML 和/或 CSS 中的某些内容。
可以在here 找到包含页脚栏的示例页面。
上述页面的 HTML 示例如下...
<body>
<div class="page-content">
<!--#include file="../../../_includes/header.shtml"-->
<div class="container">
<h2 class="container-header">About Widget</h2>
<div>
<p class="container-text">The About widget is located in the upper right-hand corner of the application, within the header, as shown below.</p>
</div>
<div class="widget-header-figure-container">
<figure>
<img class="widget-header-figure-image" src="images/about.jpg" alt="AboutWidget">
<figcaption class="figure-caption">About widget highlighted in red</figcaption>
</figure>
</div>
<div>
<p class="container-text">The About widget provides a synopsis of the application as well as the layers included within the map. Additional links that may be of interest are also provided.</p>
<p class="container-text">Contact information for the <a class="link" href="http://linncounty.org/418/GIS-Division" target="_blank">GIS Division</a> and <a class="link" href="http://linncounty.org/292/Real-Estate-Services" target="_blank">Real Estate Division</a> can be found. The Web AppBuilder Developer Edition version and application build date can be found at the bottom.</p>
</div>
</div>
<footer>
<!--#include file="../../../_includes/footer.shtml"-->
</footer>
</div>
</body>
示例 CSS 如下:
html {
font-size: 62.5%;
height: 100%;
}
body {
background-color: #d2d2d2;
font-family: 'Cuprum';
height: 100%;
}
.page-content {
min-height: 100%;
position: relative;
}
#footer-container {
width: 100%;
height: 150px;
background-color: #797986;
bottom: 0;
position: absolute;
text-align: center;
}
【问题讨论】: