自用 Uptime Kuma - 自托管站点监控工具 样式布局代码分享

自用 Uptime Kuma - 自托管站点监控工具 样式布局代码分享

演示:

自用 Uptime Kuma - 自托管站点监控工具  样式布局代码分享

代码:

/* 整体背景与字体 */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #f8f9fa;
    --dark-bg: #1a1a2e;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-radius: 12px;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

.dark {
    --light-bg: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body {
    background: linear-gradient(135deg, var(--light-bg) 0%, #e6f7ff 100%);
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    transition: var(--transition);
}

.dark body {
    background: linear-gradient(135deg, var(--dark-bg) 0%, #0d1b2a 100%);
}

/* 页面主容器 */
#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* 标题区域 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1abc9c 100%);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    color: white;
    position: relative;
    overflow: hidden;
}

header:before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 70%);
    transform: rotate(30deg);
}

header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 2;
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* 分组容器 */
.monitor-group {
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out;
}

/* 分组标题 */
h2.group-title {
    font-size: 1.8rem;
    color: var(--text-color);
    padding: 20px 25px;
    background: linear-gradient(135deg, #1abc9c 0%, var(--primary-color) 100%);
    border-radius: var(--border-radius);
    margin: 0 0 25px 0;
    color: white;
    font-weight: 600;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

h2.group-title:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #5cdd8b, #34c776, #5cdd8b);
    animation: loading 3s ease-in-out infinite;
}

/* 网格布局 - 2列显示 */
.monitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

/* 状态卡片容器 */
.status-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    transition: var(--transition);
    border: 1px solid rgba(52, 152, 219, 0.1);
    position: relative;
    overflow: hidden;
}

.status-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #1abc9c);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.status-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.status-card:hover:before {
    transform: scaleX(1);
}

/* 监控项主容器 */
.monitor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(52, 152, 219, 0.1);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    margin-bottom: 15px;
}

.dark .monitor-item {
    background: rgba(30, 30, 30, 0.5);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.monitor-item:last-child {
    margin-bottom: 0;
}

.monitor-item:hover {
    background: rgba(52, 152, 219, 0.05);
    transform: translateX(5px);
}

.monitor-item:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.monitor-item:hover:after {
    transform: scaleY(1);
}

/* 服务信息区域 */
.monitor-info {
    flex: 1;
    padding-right: 20px;
}

/* 服务名称 */
.monitor-name {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--secondary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dark .monitor-name {
    color: #f1f5f9;
}

.monitor-name .service-icon {
    font-size: 1.8rem;
    color: var(--primary-color);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 服务描述 */
.monitor-desc {
    font-size: 0.95rem;
    color: #7f8c8d;
    margin-bottom: 12px;
    line-height: 1.5;
}

.dark .monitor-desc {
    color: #94a3b8;
}

/* 状态标签区域 */
.status-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

/* 状态标签 */
.monitor-status {
    padding: 8px 20px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: center;
    min-width: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    transition: var(--transition);
    border: 2px solid;
}

.monitor-status:hover {
    transform: scale(1.05);
}

/* 不同状态的颜色 */
.status-up {
    background: linear-gradient(135deg, var(--success-color) 0%, #2ecc71 100%);
    color: white;
    border-color: var(--success-color);
}

.status-down {
    background: linear-gradient(135deg, var(--danger-color) 0%, #ff6b6b 100%);
    color: white;
    border-color: var(--danger-color);
}

.status-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #f1c40f 100%);
    color: white;
    border-color: var(--warning-color);
}

/* 证书信息 */
.cert-info {
    font-size: 0.9rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 25px;
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
    font-weight: 500;
}

.dark .cert-info {
    background: rgba(46, 204, 113, 0.15);
}

.cert-valid {
    color: var(--success-color);
    font-weight: 600;
}

.cert-invalid {
    color: var(--danger-color);
    font-weight: 600;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* 页脚 */
footer {
    text-align: center;
    margin-top: 50px;
    padding: 30px;
    color: #7f8c8d;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.dark footer {
    background: rgba(30, 30, 30, 0.8);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
    margin: 5px 0;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .monitor-grid {
        grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    }
}

@media (max-width: 768px) {
    #app {
        padding: 20px 15px;
    }
  
    header {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
  
    header h1 {
        font-size: 2.2rem;
    }
  
    header p {
        font-size: 1rem;
    }
  
    .monitor-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
  
    .status-card {
        padding: 25px 20px;
    }
  
    h2.group-title {
        font-size: 1.5rem;
        padding: 15px 20px;
    }
  
    .monitor-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 20px;
    }
  
    .monitor-info {
        padding-right: 0;
        width: 100%;
    }
  
    .status-section {
        align-items: stretch;
        width: 100%;
    }
  
    .monitor-status {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
  
    .monitor-name {
        font-size: 1.1rem;
    }
  
    .status-card {
        padding: 20px 15px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(52, 152, 219, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 状态指示器 */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.indicator-up {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-color);
}

.indicator-down {
    background: var(--danger-color);
    box-shadow: 0 0 10px var(--danger-color);
}

.indicator-warning {
    background: var(--warning-color);
    box-shadow: 0 0 10px var(--warning-color);
}

/* 卡片悬停效果增强 */
.card-hover {
    position: relative;
    overflow: hidden;
}

.card-hover:before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(52, 152, 219, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
    opacity: 0;
}

.card-hover:hover:before {
    transform: rotate(45deg) translate(50%, 50%);
    opacity: 1;
}
版权声明

   站内部分内容来自互联网,该文仅限用于学习和研究目的。本站仅提供网络资源分享服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请 点击我 一经核实,立即删除。访问和下载本站内容,说明您已同意上述条款。在为用户提供最好的产品同时,保证优秀的服务质量。


本站仅提供信息存储空间,不拥有所有权,不承担相关法律责任。
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容