卡片边框

This commit is contained in:
Zuoling Rong
2025-01-31 21:14:41 +08:00
parent 7ba1d8e793
commit 6ea490bf69
2 changed files with 204 additions and 9 deletions

View File

@@ -88,7 +88,6 @@ python -m http.server 8000
## 开发计划 ## 开发计划
- [ ] 添加明暗主题切换
- [ ] 支持自定义分类 - [ ] 支持自定义分类
- [ ] 添加更多动画效果 - [ ] 添加更多动画效果
- [ ] 支持数据持久化 - [ ] 支持数据持久化

212
style.css
View File

@@ -11,6 +11,7 @@ body {
background-color: #1a1b1e; background-color: #1a1b1e;
color: #e4e6eb; color: #e4e6eb;
min-height: 100vh; min-height: 100vh;
overflow-x: hidden;
} }
/* 布局 */ /* 布局 */
@@ -19,6 +20,7 @@ body {
min-height: 100vh; min-height: 100vh;
opacity: 0; opacity: 0;
animation: fadeIn 0.3s ease-out forwards; animation: fadeIn 0.3s ease-out forwards;
overflow-x: hidden;
} }
/* 侧边栏样式 */ /* 侧边栏样式 */
@@ -84,17 +86,19 @@ body {
.content { .content {
flex: 1; flex: 1;
margin-left: 250px; margin-left: 250px;
padding: 2rem; padding: 2rem 0;
background-color: #1a1b1e; background-color: #1a1b1e;
position: relative; position: relative;
min-height: 100vh; min-height: 100vh;
overflow-x: hidden;
max-width: calc(100vw - 250px);
} }
/* 搜索框 */ /* 搜索框 */
.search-box { .search-box {
position: relative; position: relative;
max-width: 600px; max-width: 600px;
margin-bottom: 3rem; margin: 0 2rem 3rem 2rem;
} }
.search-box::after { .search-box::after {
@@ -159,7 +163,7 @@ body {
/* 欢迎区域 */ /* 欢迎区域 */
.welcome-section { .welcome-section {
margin-bottom: 3rem; margin: 0 2rem 3rem 2rem;
} }
.welcome-section h2 { .welcome-section h2 {
@@ -184,7 +188,7 @@ body {
background-color: #2d2e32; background-color: #2d2e32;
border-radius: 15px; border-radius: 15px;
padding: 2rem; padding: 2rem;
margin-bottom: 2rem; margin: 0 2rem 2rem 2rem;
transform: translateZ(0); transform: translateZ(0);
will-change: transform, opacity; will-change: transform, opacity;
animation: none; animation: none;
@@ -208,15 +212,15 @@ body {
/* 网站卡片网格 */ /* 网站卡片网格 */
.sites-grid { .sites-grid {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 1.5rem; gap: 1.2rem;
} }
/* 网站卡片样式 */ /* 网站卡片样式 */
.site-card { .site-card {
background-color: #3a3b3f; background-color: #3a3b3f;
border-radius: 12px; border-radius: 12px;
padding: 1.5rem; padding: 1.2rem;
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
transition: all 0.3s ease; transition: all 0.3s ease;
@@ -227,6 +231,8 @@ body {
backface-visibility: hidden; backface-visibility: hidden;
transform: translateZ(0); transform: translateZ(0);
will-change: transform; will-change: transform;
max-width: 100%;
position: relative;
} }
.site-card:hover { .site-card:hover {
@@ -250,6 +256,183 @@ body {
color: #8b8c8f; color: #8b8c8f;
} }
/* 添加编辑按钮 */
.edit-buttons {
position: absolute;
top: 0.5rem;
right: 0.5rem;
display: flex;
gap: 0.5rem;
opacity: 0;
transition: opacity 0.3s ease;
}
.site-card:hover .edit-buttons {
opacity: 1;
}
.edit-btn, .delete-btn {
background: none;
border: none;
color: #8b8c8f;
cursor: pointer;
padding: 0.3rem;
border-radius: 4px;
transition: all 0.3s ease;
}
.edit-btn:hover, .delete-btn:hover {
color: #fff;
background-color: #4a4b4f;
}
/* 添加网站按钮 */
.add-site-btn {
background-color: #3a3b3f;
border: 2px dashed #4a4b4f;
border-radius: 12px;
padding: 1.2rem;
color: #8b8c8f;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 160px;
}
.add-site-btn:hover {
background-color: #4a4b4f;
border-color: #5a5b5f;
color: #fff;
}
.add-site-btn i {
font-size: 2rem;
margin-bottom: 0.5rem;
}
/* 模态框样式 */
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: none;
justify-content: center;
align-items: center;
z-index: 1000;
}
.modal.active {
display: flex;
}
.modal-content {
background-color: #2d2e32;
border-radius: 15px;
padding: 2rem;
width: 90%;
max-width: 500px;
position: relative;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1.5rem;
}
.modal-header h3 {
color: #fff;
font-size: 1.2rem;
}
.close-modal {
background: none;
border: none;
color: #8b8c8f;
cursor: pointer;
font-size: 1.5rem;
padding: 0.5rem;
transition: color 0.3s ease;
}
.close-modal:hover {
color: #fff;
}
/* 表单样式 */
.site-form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.form-group {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.form-group label {
color: #8b8c8f;
font-size: 0.9rem;
}
.form-group input, .form-group select {
background-color: #3a3b3f;
border: none;
border-radius: 8px;
padding: 0.8rem 1rem;
color: #fff;
font-size: 1rem;
}
.form-group input:focus, .form-group select:focus {
outline: none;
background-color: #4a4b4f;
}
.form-actions {
display: flex;
justify-content: flex-end;
gap: 1rem;
margin-top: 1.5rem;
}
.btn {
padding: 0.8rem 1.5rem;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 1rem;
transition: all 0.3s ease;
}
.btn-primary {
background-color: #4a9eff;
color: #fff;
}
.btn-primary:hover {
background-color: #3a8eef;
}
.btn-secondary {
background-color: #3a3b3f;
color: #8b8c8f;
}
.btn-secondary:hover {
background-color: #4a4b4f;
color: #fff;
}
/* 响应式设计 */ /* 响应式设计 */
@media (max-width: 768px) { @media (max-width: 768px) {
.sidebar { .sidebar {
@@ -275,7 +458,7 @@ body {
.content { .content {
margin-left: 70px; margin-left: 70px;
padding: 1rem; padding: 1rem 0;
} }
.welcome-section h2 { .welcome-section h2 {
@@ -293,6 +476,19 @@ body {
#search-results { #search-results {
transform: translateY(10px); transform: translateY(10px);
} }
.category {
margin: 0 1rem 2rem 1rem;
padding: 1.5rem;
}
.welcome-section {
margin: 0 1rem 2rem 1rem;
}
.search-box {
margin: 0 1rem 2rem 1rem;
}
} }
/* 动画效果 */ /* 动画效果 */