我的页脚在正常的屏幕尺寸上绝对可以,但是我希望在将屏幕缩小一定高度后变得不可见。
HTML:
<footer class="footer">
About
</footer>
CSS:
.footer{
position: fixed;
bottom: 0;
margin: 0;
padding: 10px;
width: 100%;
box-shadow: 0 0 3px white;
color:white;
}
在页面上使用最大高度媒体查询以隐藏页脚。请注意,除了IE8-以外,几乎所有浏览器都兼容。
用于演示的html
<div id="footer">Footer</div>
的CSS
@media (max-height:150px) {
#footer{
display:none;
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句