我有一个问题。在对站点的侧页进行编码时,我无法将页脚绑定(bind)到站点的地下室。我使用 Bootstrap 类。尝试使用此类代码时:
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}
页脚要么保留在原位,要么关闭内容,接近导航栏。 如何解决这个问题?
使用代码后 /image/XnnaS.png
附言我为糟糕的英语道歉
最佳答案
100%
的高度与您想象的不同。在这种情况下,您正在寻找 vh
单位。我还将它们应用于 body
,而不是 html
。
*{box-sizing: border-box;}
body {
/* Margin bottom by footer height */
margin: 0;
padding: 0;
min-height: 100vh;
position: relative;
}
footer {
position: absolute;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
bottom: 0;
}
<body>
content
<footer>
footer
</footer>
</body>
关于javascript - 使用 mmenu 时无法添加页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43526715/