页脚制作 css
页脚基础样式
使用CSS为页脚设置基础样式,通常包括背景色、文字颜色、内边距等属性。以下是一个常见示例:
footer {
background-color: #333;
color: white;
padding: 20px 0;
text-align: center;
font-size: 14px;
}
固定底部定位
对于需要始终显示在页面底部的页脚,可以使用固定定位:
footer {
position: fixed;
bottom: 0;
width: 100%;
height: 60px;
line-height: 60px;
}
响应式页脚设计
使用媒体查询确保页脚在不同设备上显示良好:

@media (max-width: 768px) {
footer {
padding: 15px 0;
font-size: 12px;
}
}
页脚链接样式
为页脚中的链接添加特定样式,通常与主体内容链接有所不同:
footer a {
color: #ccc;
text-decoration: none;
margin: 0 10px;
}
footer a:hover {
color: white;
text-decoration: underline;
}
多列布局页脚
创建包含多列内容的页脚布局:

.footer-container {
display: flex;
justify-content: space-around;
max-width: 1200px;
margin: 0 auto;
}
.footer-column {
flex: 1;
padding: 0 15px;
}
页脚版权信息样式
专门为版权信息设置样式:
.copyright {
margin-top: 20px;
font-size: 12px;
color: #999;
}
粘性页脚实现
对于内容不足一屏的页面,可以使用粘性页脚技术:
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1;
}
页脚阴影效果
添加微妙的上阴影增强视觉效果:
footer {
box-shadow: 0 -5px 10px rgba(0,0,0,0.1);
}






