在任何情况下如何在页面底部放置页脚?
How to have a footer in the bottom of the page on any case?
我想在 HTML 页面的底部有一个固定的页脚,即使是 XS 和 SM 尺寸。
当我让它相对时,它取决于显示的内容,我希望它固定在底部。
有人可以帮我吗?
您可以使用以下样式:
position: fixed;
bottom: 0;
left: 0;
right: 0;
您当然必须根据您的具体情况对其进行调整。如果您有代码示例,我可以为您提供更具体的内容。
这就是您获得粘性页脚的方式
body{
min-height: 100vh;
flex-direction: column;
}
footer{
margin-top:auto;
}
我想在 HTML 页面的底部有一个固定的页脚,即使是 XS 和 SM 尺寸。
当我让它相对时,它取决于显示的内容,我希望它固定在底部。
有人可以帮我吗?
您可以使用以下样式:
position: fixed;
bottom: 0;
left: 0;
right: 0;
您当然必须根据您的具体情况对其进行调整。如果您有代码示例,我可以为您提供更具体的内容。
这就是您获得粘性页脚的方式
body{
min-height: 100vh;
flex-direction: column;
}
footer{
margin-top:auto;
}