[英]Footer not hiding on smaller screen sizes
I am trying to hide my footer for small devices and screens.我正在尝试为小型设备和屏幕隐藏页脚。 Any thoughts on how I could do so?关于我如何做到这一点的任何想法? I had tried:我试过:
<div class="hidden-xs">
and <div class="hidden-xs">
和
@media screen and (max-width: 600px) {
.footer {
visibility: hidden;
display: none;
}
}
Which were popular solutions online, but no luck.这是网上流行的解决方案,但没有运气。 My code is below:我的代码如下:
HTML HTML
<footer>
<div class="copyright"><p>Copyright; url 2021</p></div>
<div class="location">Footer text</div>
<div class="contact">WhatsUp@url.com</div>
</footer>
CSS CSS
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: white;
color: white;
text-align: center;
height: 80px;
display: flex;
justify-content: space-between;
border-style: 1px thin solid red;
}
You are not hiding actual footer, but a div with a .footer
class, which does not exist in your case.您没有隐藏实际的页脚,而是一个带有.footer
class 的 div,在您的情况下不存在。
Try this:尝试这个:
@media screen and (max-width: 600px) {
footer {
display: none;
}
}
<footer>
<div class="copyright"><p>Copyright; url 2021</p></div>
<div class="location">Footer text</div>
<div class="contact">WhatsUp@url.com</div>
</footer>
Now you are hiding a footer
element.现在你隐藏了一个footer
元素。
Remove .
删除.
from .footer
css class从.footer
css class
You use footer
tag directly in css您直接在 css 中使用footer
标签
@media screen and (max-width: 600px) {
footer {
visibility: hidden;
display: none;
}
}
Or add class="footer"
to footer
tag或将class="footer"
添加到footer
标签
If you use bootstrap , you can add this class d-block d-sm-none
如果你使用bootstrap ,你可以添加这个 class d-block d-sm-none
<footer class="d-block d-sm-none">
...
</footer>
Or you can remove the .
或者您可以删除.
on your css在你的css
@media screen and (max-width: 600px) {
footer {
display: none;
}
}
Or add class="footer"
on your html或者在您的html上添加class="footer"
HTML HTML
<footer class="footer">
...
</footer>
CSS CSS
@media screen and (max-width: 600px) {
.footer {
display: none;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.