我认为您需要position:fixed
尝试通过在正文中添加大量虚拟数据来进行实验,以便滚动页面。
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Some Page</title>
<style type="text/css">
#footer{
position:fixed;
bottom:0px;
background-color: black;
color:white;
}
</style>
</head>
<body>
<h1>Some Page</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<div id="footer">
© company name
</div>
</body>
</html>
我希望这有帮助