个人导航主页设计:从简陋到毛玻璃风格的改造记录
一、原始页面的问题 最初的个人导航主页(zhuye)功能上能用,但视觉上存在几个问题: 白色背景:纯白底色缺乏…
一、原始页面的问题
最初的个人导航主页(zhuye)功能上能用,但视觉上存在几个问题:
- 白色背景:纯白底色缺乏层次感,视觉上显得简陋
- 扁平化设计:卡片没有阴影和立体感,悬浮效果生硬
- 内外网分离:通过开关切换 External/Internal 两个网格,交互复杂
- 布局松散:图标和文字间距不均衡,整体缺乏精致感
二、设计目标
- 深色主题,保护视力且更有科技感
- 毛玻璃(Glassmorphism)风格,半透明卡片 + 模糊背景
- 统一展示所有服务,不再区分内外网
- 平滑动画,提升交互质感
- 响应式设计,手机端也能用
三、技术实现
3.1 动态渐变背景
使用 CSS 伪元素 + 径向渐变 + 关键帧动画,实现缓慢漂移的光晕效果:
body::before {
content: "";
position: fixed;
top: -50%; left: -50%;
width: 200%; height: 200%;
background:
radial-gradient(ellipse at 20% 50%, rgba(72,50,128,0.25) 0%, transparent 50%),
radial-gradient(ellipse at 80% 20%, rgba(30,60,140,0.2) 0%, transparent 50%),
radial-gradient(ellipse at 50% 80%, rgba(20,80,100,0.15) 0%, transparent 50%);
z-index: -1;
animation: bgShift 20s ease-in-out infinite alternate;
}
@keyframes bgShift {
0% { transform: translate(0, 0) rotate(0deg); }
100% { transform: translate(-2%, -2%) rotate(3deg); }
}
3.2 毛玻璃卡片
每个服务卡片使用 backdrop-filter 实现毛玻璃效果:
.app-grid .app-item {
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 16px;
backdrop-filter: blur(12px);
transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.app-grid .app-item:hover {
background: rgba(255, 255, 255, 0.08);
border-color: rgba(160, 128, 255, 0.25);
box-shadow: 0 8px 32px rgba(72, 50, 128, 0.15);
transform: translateY(-4px);
}
3.3 渐变色标题
.hero h1 {
background: linear-gradient(135deg, #f0f0f8 0%, #a080ff 50%, #60a0f0 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
3.4 卡片入场动画
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.app-grid .app-item { animation: fadeInUp 0.5s ease forwards; opacity: 0; }
.app-grid .app-item:nth-child(1) { animation-delay: 0.05s; }
.app-grid .app-item:nth-child(2) { animation-delay: 0.1s; }
.app-grid .app-item:nth-child(3) { animation-delay: 0.15s; }
.app-grid .app-item:nth-child(4) { animation-delay: 0.2s; }
.app-grid .app-item:nth-child(5) { animation-delay: 0.25s; }
.app-grid .app-item:nth-child(6) { animation-delay: 0.3s; }
.app-grid .app-item:nth-child(7) { animation-delay: 0.35s; }
.app-grid .app-item:nth-child(8) { animation-delay: 0.4s; }
.app-grid .app-item:nth-child(9) { animation-delay: 0.45s; }
.app-grid .app-item:nth-child(10) { animation-delay: 0.5s; }
.app-grid .app-item:nth-child(11) { animation-delay: 0.55s; }
.app-grid .app-item:nth-child(12) { animation-delay: 0.6s; }
.app-grid .app-item:nth-child(13) { animation-delay: 0.65s; }
四、响应式适配
.app-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
gap: 14px;
}
@media (max-width: 480px) {
.app-grid {
grid-template-columns: repeat(3, 1fr);
gap: 8px;
}
}
五、备案号与合规
根据工信部要求,在 footer 中添加了备案号:
<a href="https://beian.miit.gov.cn/" target="_blank">晋ICP备2026006718号</a>
六、改造前后对比
| 维度 | 改造前 | 改造后 |
|---|---|---|
| 背景 | 纯白 | 深色渐变 + 动态光晕 |
| 卡片风格 | 扁平无阴影 | 毛玻璃 + 发光悬浮 |
| 内外网 | 开关切换 | 统一展示 |
| 动画 | 无 | 淡入上浮 + 弹性悬浮 |
| 字体 | 系统默认 | Inter 字体 + 渐变标题 |
| 搜索框 | 普通输入框 | 毛玻璃搜索 + 紫光聚焦 |
| 备案号 | 无 | footer 显示 |
七、经验总结
- CSS 的 backdrop-filter 是实现毛玻璃效果的关键,但注意浏览器兼容性
- 渐变文字使用 -webkit-background-clip: text,标准属性是 background-clip: text
- 弹性缓动(cubic-bezier)比线性过渡更有质感
- 移动端优先设计,先保证手机可用再优化桌面
- 备案号是必选项,不是可选项
