Javascript 引导边栏和页脚工作不正常
我必须为许多使用jQuery和Bootstrap3开发的网页添加页脚。我已经写了以下脚本的基础上做这项工作Javascript 引导边栏和页脚工作不正常,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我必须为许多使用jQuery和Bootstrap3开发的网页添加页脚。我已经写了以下脚本的基础上做这项工作 // Default $( document ).ready(function() { $('body').append('<footer class="footer">' + ' © 2015 ABC Company. All rights reserved. | Content for inte
// Default
$( document ).ready(function() {
$('body').append('<footer class="footer">' +
' © 2015 ABC Company. All rights reserved. | Content for internal use only. | ' +
'<a href="mailto:#">Contact Us</a> ' +
' </footer>');
});
这适用于所有页面,但带有边栏的页面除外,边栏与页脚重叠,如下所示
我试图通过添加边距底部:40px;/*CSS中按页脚高度调整页边距底部*/
到。侧边栏
。现在它看起来像下面
如何解决这个问题?我无法为每个页面添加单独的页脚并为其设置样式,因为页面很多。在页脚的css中添加z-index:600,将使页脚位于所有内容的顶部。您需要告诉页脚显示在页面上其他元素的前面。使用
z-index
CSS属性应该可以帮助解决这个问题。感谢您修复了忘记z-index
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 40px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 40px;
background-color: #99FFFF;
padding-top:5px;
}