如何使用 CSS 创建固定/粘性页面页脚?
要使用 CSS 创建固定页脚,代码如下 −
示例
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body{
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.footer {
font-size: 20px;
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: rgb(50, 6, 100);
color: white;
text-align: center;
}
</style>
</head>
<body>
<h1>Fixed/Sticky Footer Example</h1>
<div class="footer">
<p>All rights reserved ©</p>
</div>
</body>
</html>输出
以上代码将产生如下输出 −

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP