首页 > 解决方案 > 如果位置固定,为什么我的页脚只停留在底部

问题描述

如果我将位置设为绝对位置,它会在更大的屏幕上向上移动并在其下方留下一个空白区域。

 <div class="footer">
<footer id="footer">Brought into existence by yours truly</footer>
 </div>

.footer {
background-color: rgb(177, 74, 197);
text-align: center;
font-family: 'Knewave';
color: rgb(114, 245, 190);
width: 100%;
margin-bottom: 0;
bottom: 0;
left: 0;
position: fixed;

 }

标签: htmlcss

解决方案


您可以找到有关 w3 school的更多信息,从链接中总结绝对定位基于项目的最后一个祖先的项目位置。固定位置相对于视口的东西。


推荐阅读