无数据提示模块 HTML 代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>无数据提示</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* 基础样式重置 */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
/* 页面容器 */
.container {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 20px;
background-color: #f5f7fa;
animation: fadeIn 0.6s ease-out;
}
/* 无数据卡片 */
.empty-state {
max-width: 500px;
width: 100%;
padding: 40px;
background: white;
border-radius: 16px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
text-align: center;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.empty-state:hover {
transform: translateY(-5px);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}
/* 图标样式 */
.empty-icon {
font-size: 5rem;
margin-bottom: 20px;
color: #a0aec0;
display: inline-block;
animation: bounce 2s infinite;
}
/* 标题样式 */
.empty-title {
font-size: 1.75rem;
font-weight: 600;
color: #2d3748;
margin-bottom: 12px;
}
/* 描述文本 */
.empty-description {
font-size: 1.1rem;
color: #718096;
line-height: 1.6;
margin-bottom: 30px;
max-width: 80%;
margin-left: auto;
margin-right: auto;
}
/* 操作按钮 */
.empty-action {
display: inline-block;
padding: 12px 28px;
background-color: #4299e1;
color: white;
border-radius: 8px;
text-decoration: none;
font-weight: 500;
font-size: 1rem;
transition: all 0.3s ease;
border: none;
cursor: pointer;
box-shadow: 0 4px 6px rgba(66, 153, 225, 0.2);
}
.empty-action:hover {
background-color: #3182ce;
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(66, 153, 225, 0.3);
}
/* 动画效果 */
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes bounce {
0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
40% { transform: translateY(-20px); }
60% { transform: translateY(-10px); }
}
/* 响应式调整 */
@media (max-width: 600px) {
.empty-state {
padding: 30px 20px;
}
.empty-icon {
font-size: 4rem;
}
.empty-title {
font-size: 1.5rem;
}
.empty-description {
font-size: 1rem;
max-width: 100%;
}
}
</style>
</head>
<body>
<div class="container">
<div class="empty-state">
<div class="empty-icon">
<i class="fas fa-database"></i>
</div>
<h2 class="empty-title">暂无数据</h2>
<p class="empty-description">
当前没有找到相关数据记录,您可以尝试刷新页面或创建新的数据内容。
如有任何疑问,请联系我们的客服支持。
</p>
<button class="empty-action" onclick="location.reload()">
<i class="fas fa-sync-alt"></i> 刷新试试
</button>
</div>
</div>
</body>
</html>这个代码实现了以下功能:
- 响应式设计 - 适配各种屏幕尺寸
- 圆角卡片布局 - 16px圆角
- 智能配色方案 - 使用柔和的蓝色和灰色调
动画效果:
- 页面淡入
- 图标弹跳动画
- 卡片悬停上浮
- 按钮悬停效果
- 清晰的字体层次结构
- 使用Font Awesome 6.4.0图标
- 包含一个可操作的刷新按钮
需支付 5元 阅读剩余内容