【发布时间】:2018-04-04 15:57:14
【问题描述】:
我想将页脚固定在底部间隙。如果内容较少,页脚即将出现并且内容完整问题已解决,并且页脚应固定在底部,而我将放大或缩小。但是当我缩放时,页脚会转到内容部分
<head runat="server">
<asp:contentplaceholder id="HeaderContent" runat="server"></asp:contentplaceholder>
</head>
<body class="hidden-sn white-skin backcolor">
<form id="form1" runat="server">
<main>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server"></asp:contentplaceholder>
</main>
<!--main layout-->
<!--footer-->
<footer id="footer" style="position:relative;bottom: 0;left: 0;width: 100%; height: 50px;text-align: center; color: rgba(255, 255, 255, 0.6); line-height: 50px; overflow: hidden; font-size: 0.9rem; background-color: rgba(62, 69, 81, 0.3)">
<div class="footer-copyright">
<div class="container-fluid">
© copyright 2016 transgraph consulting pvt.ltd, all rights reserved.
</div>
</div>
</footer>
</body>
</html>
这是我的母版页。
position: relative ---> if content is less coming up.
position: absolute and fixed ----> if content is more getting on content.
var docHeight = $(window).height();
var footerHeight = $('#footer').height();
var footerTop = $('#footer').position().top + footerHeight;
if (footerTop < docHeight) {
$('#footer').css('margin-top', 0 + (docHeight - footerTop) + 'px');
}
我使用 jQuery 来修复它。将我的页脚固定在底部。建议我使用 CSS 或 jQuery 解决这个问题。我想在底部间隙修复我的页脚。如果内容较少,页脚即将出现并且内容完整问题已解决,并且页脚应固定在底部,而我将放大或缩小。但是当我缩放时,页脚会转到内容部分
【问题讨论】: