我認(rèn)為你可以給它添加一個父級div,父級div的寬度和高度與它相同。
html:
.footer { position: fixed; bottom: 0; left: 0; width: 100vw; height: 200px; background-color: red; } .footer-container { height: 200px; width: 100vw; }
<div class="footer-container"> <div class="footer"></div> </div>