[英]Force Footer to Stay at Bottom of Page With Small Viewport
I am making an app for myself with ElectronJS.我正在用 ElectronJS 为自己制作一个应用程序。 I have managed to get the footer to stay at the bottom of the viewport when it is large, but when I shrink the viewport the footer overlaps some of the content on my page.
当页脚很大时,我设法让页脚保持在视口的底部,但是当我缩小视口时,页脚会与页面上的一些内容重叠。 Can someone please help me?
有人可以帮帮我吗? I have attached some pictures to show you all with what I am dealing with.
我附上了一些图片,向大家展示我正在处理的事情。
What I am getting with small viewport.我用小视口得到了什么。
Here is my CSS for my footer class that I am using:这是我正在使用的页脚 class 的 CSS:
/* Footer Styling */
.footer {
position: absolute; bottom: 0px;
width: 100%;
}
Your help is greatly appreciated.非常感谢您的帮助。
if you want client see footer all the time in small viewport use position: fixed
, and if you want footer only at the end of all contents in small view port use @media
in css like this:如果您希望客户始终在小视口中看到页脚,请使用
position: fixed
,如果您希望仅在小视口中的所有内容的末尾使用页脚,请使用 css 中的@media
,如下所示:
@media (min-width: 0) and (max-width: 768px){
.footer {
position: relative;
/*bottom: 0px;*/
width: 100%;
}
}
@media (min-width: 768px){
.footer {
position: fixed;
bottom: 0;
left: 0;
height: 200px;
width: 100%;
}
}
also if you want use position: absolute
check height of .footer
in inspect and add height: "num"px;
如果你想使用
position: absolute
check height of .footer
in inspect 并添加height: "num"px;
or use height: 100%
.或使用
height: 100%
。
you can use min-height and max-height
in @media
like this:您可以像这样在
@media
中使用min-height and max-height
:
.footer {
position: fixed;
bottom: 0;
left: 0;
height: 200px;
width: 100%;
}
@media (min-height: 650px){
.footer {
position: relative;
/*bottom: 0px;*/
width: 100%;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.