页脚制作 css
基础页脚样式设计
页脚通常包含版权信息、联系方式或导航链接。使用CSS设置基本样式:
footer {
background-color: #333;
color: white;
padding: 20px 0;
text-align: center;
font-family: Arial, sans-serif;
}
响应式页脚布局
使用Flexbox实现自适应布局,确保在不同设备上正常显示:
footer {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
max-width: 1200px;
margin: 0 auto;
}
.footer-section {
flex: 1;
min-width: 200px;
padding: 15px;
}
页脚链接样式
为页脚中的导航链接添加交互效果:

.footer-links a {
color: #ccc;
text-decoration: none;
margin: 0 10px;
transition: color 0.3s;
}
.footer-links a:hover {
color: white;
text-decoration: underline;
}
固定底部页脚
创建始终停留在页面底部的页脚:
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
main {
flex: 1;
}
footer {
margin-top: auto;
}
页脚社交媒体图标
添加社交媒体图标并设置样式:

.social-icons {
display: flex;
justify-content: center;
gap: 15px;
}
.social-icons a {
color: white;
font-size: 24px;
transition: transform 0.3s;
}
.social-icons a:hover {
transform: translateY(-3px);
}
页脚版权信息样式
设置版权信息的特定样式:
.copyright {
font-size: 14px;
opacity: 0.8;
margin-top: 20px;
border-top: 1px solid rgba(255,255,255,0.1);
padding-top: 20px;
}
暗黑/明亮模式切换
为页脚添加主题切换支持:
footer.light-mode {
background-color: #f5f5f5;
color: #333;
}
footer.light-mode .footer-links a {
color: #666;
}
footer.light-mode .footer-links a:hover {
color: #000;
}






