atlas-study/grid-study/styles.css
Coldin04 5b79d2179f feat: 完善 Grid 布局主页的所有卡片内容与样式
- **Profile**: 完成个人信息展示,适配桌面(居中)与移动端(左图右文)布局。
- **RSS**: 接入少数派文章数据(静态模拟),优化列表视觉效果及底部“查看更多”按钮。
- **Task**: 实现待办事项列表样式,优化间距与交互反馈,清理无用标签。
- **Hitokoto**: 集成一言 API(内联 JS),支持出处展示与跳转。
- **Photos**: 替换为本地图片资源,去除边框以提升沉浸感,并限制高度以防止布局变形。
- **Layout**: 全局添加 `box-sizing: border-box`,微调 Grid 行高、间距及边距,解决垂直滚动条问题。
- **Mobile**: 优化移动端响应式表现,确保内容在不同设备上的可读性。
2026-01-23 14:57:23 +08:00

454 lines
7.9 KiB
CSS

* {
box-sizing: border-box;
}
body {
background-image: url('src/wallpaper/big_sure.webp');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
}
/* 顶栏样式 */
.top-bar {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
padding: 8px 16px;
margin:10px 16px;
/* 黏性定位 */
position: sticky;
top: 5px;
z-index: 100;
background-color: rgba(255, 255, 255, 0.8);
/* 毛玻璃效果 */
backdrop-filter: blur(10px);
/* 顶栏圆角效果 */
border-radius: 12px;
}
.top-bar__brand {
font-weight: 550;
font-size: 20px;
display: flex;
align-items: center;
gap: 16px;
}
.top-bar__logo {
width: 32px;
height: 32px;
place-items: center;
border-radius: 50%;
object-fit: cover;
}
.top-bar__actions {
display: flex;
gap: 8px;
}
.top-bar__button {
padding: 8px 16px;
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 8px;
background-color: rgba(255, 255, 255, 0.5);
backdrop-filter: blur(5px);
cursor: pointer;
font-size: 14px;
transition: var(--transition);
}
.top-bar__button:hover {
background-color: rgba(255, 255, 255, 0.8);
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.top-bar__button:active {
transform: translateY(0);
}
/* 主区域样式 */
.main-content {
gap: 24px;
max-width: 1200px; /* 最大宽度限制 */
margin: 20px auto;
padding: 0 80px 20px 80px;
}
.dashboard-grid{
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: minmax(150px, auto); /* 自动行高 */
grid-auto-flow: dense; /* 紧凑排列 */
gap: 24px;
}
.card{
background-color: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(10px);
border-radius: 20px;
border: 1px solid rgba(255, 255, 255, 0.2);
padding: 20px;
color: #333;
display: flex;
align-items: center;
gap: 16px;
transition: var(--transition);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.card__profile{
grid-column: span 1;
grid-row: span 2;
flex-direction: column;
justify-content: center;
align-items: center;
}
/* 个人卡片样式 */
.profile {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 16px;
width: 100%;
}
.profile__avatar {
width: 120px;
height: 120px;
border-radius: 50%;
object-fit: cover;
border: 4px solid rgba(255, 255, 255, 0.8);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.profile__avatar:hover {
transform: scale(1.05);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.profile__content {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.profile__name {
margin: 0;
font-size: 24px;
font-weight: 600;
color: #333;
letter-spacing: 0.5px;
}
.profile__signature {
margin: 0;
font-size: 14px;
color: #666;
font-style: italic;
max-width: 200px;
line-height: 1.5;
}
.card__rss{
grid-column: span 2;
grid-row: span 2;
align-items: flex-start;
}
/* RSS 区域样式 */
.rss-wrapper {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.rss-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid rgba(0,0,0,0.06);
}
.rss-header h3 {
margin: 0;
font-size: 18px;
font-weight: 600;
color: #1d1d1f;
}
.rss-status {
font-size: 12px;
color: #86868b;
background: rgba(0,0,0,0.05);
padding: 4px 10px;
border-radius: 12px;
}
.rss-list {
flex: 1;
display: flex;
flex-direction: column;
gap: 16px;
overflow-y: auto;
padding-right: 4px;
}
.rss-item {
display: flex;
flex-direction: column;
gap: 4px;
}
.rss-meta {
display: flex;
align-items: center;
gap: 8px;
font-size: 12px;
color: #86868b;
}
.rss-tag {
color: #d93535;
font-weight: 500;
}
.rss-item h4 {
margin: 0;
font-size: 15px;
font-weight: 600;
line-height: 1.4;
}
.rss-item h4 a {
color: #1d1d1f;
text-decoration: none;
transition: color 0.2s;
}
.rss-item h4 a:hover {
color: #d93535;
}
.rss-item p {
margin: 4px 0 0 0;
font-size: 13px;
color: #666;
line-height: 1.5;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.rss-footer {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid rgba(0,0,0,0.06);
text-align: center;
}
.rss-more-btn {
display: inline-block;
padding: 6px 16px;
font-size: 13px;
color: #d93535;
background-color: rgba(217, 53, 53, 0.1);
border-radius: 16px;
text-decoration: none;
font-weight: 500;
transition: all 0.2s;
}
.rss-more-btn:hover {
background-color: #d93535;
color: white;
}
.card__hitokoto{
grid-column: span 1;
grid-row: span 1;
justify-content: center;
}
/* 一言样式 */
.hitokoto-content {
width: 100%;
}
.hitokoto__text {
font-size: 18px;
line-height: 1.6;
margin: 0 0 8px 0;
text-align: center;
font-weight: 500;
}
.hitokoto__from {
font-size: 13px;
color: #888;
text-align: right;
margin: 0;
}
.card__photos{
grid-column: span 1;
grid-row: span 1;
padding: 0;
overflow: hidden;
height: 180px;
}
.card__photos img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.card__task{
grid-column: span 2;
grid-row: span 2;
align-items: flex-start;
}
/* 任务列表样式 */
.task-container {
width: 100%;
display: flex;
flex-direction: column;
}
.task-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid rgba(0,0,0,0.06);
}
.task-header h3 {
margin: 0;
font-size: 18px;
font-weight: 600;
color: #1d1d1f;
}
.task-count {
font-size: 12px;
color: #86868b;
background: rgba(0,0,0,0.05);
padding: 4px 10px;
border-radius: 12px;
}
.task-list {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.task-item {
display: flex;
align-items: center;
gap: 12px;
padding: 6px 8px;
border-radius: 8px;
transition: background-color 0.2s ease;
}
.task-item:hover {
background-color: rgba(0,0,0,0.03);
}
.task-item input[type="checkbox"] {
width: 18px;
height: 18px;
margin: 0;
accent-color: #0071e3;
cursor: pointer;
}
.task-content {
flex: 1;
font-size: 15px;
color: #333;
cursor: pointer;
transition: all 0.2s ease;
}
/* 完成状态 */
.task-item input:checked + .task-content {
text-decoration: line-through;
color: #86868b;
}
/* 响应式设计 */
@media (max-width: 900px) {
.dashboard-grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (max-width: 600px) {
.main-content {
padding: 0 20px 40px 20px;
}
.dashboard-grid {
grid-template-columns: 1fr;
gap: 16px;
grid-auto-rows: auto;
}
.card {
grid-column: span 1 !important;
grid-row: auto !important;
order: 10;
}
.card__profile{
grid-column: span 1;
order: 1;
}
.profile {
flex-direction: row;
text-align: left;
align-items: center;
}
.profile__avatar {
width: 80px;
height: 80px;
}
.card__rss,.card__task{
grid-column: span 1;
}
.card__hitokoto{
order: 2;
}
.card__photos {
height: 140px;
}
}