feat: 完成 Grid 布局框架搭建 (v0.1)
This commit is contained in:
commit
38c538cfb1
5 changed files with 198 additions and 0 deletions
32
grid-study/index.html
Normal file
32
grid-study/index.html
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Grid布局主页</title>
|
||||||
|
<link rel="stylesheet" href="styles.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header class="top-bar">
|
||||||
|
<div class="top-bar__brand">
|
||||||
|
<img src="src/avatar_48.png" alt="Logo" class="top-bar__logo">
|
||||||
|
<span>Coldin04 WorkSpace</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="top-bar__actions">
|
||||||
|
<button class="top-bar__button">主页</button>
|
||||||
|
<button class="top-bar__button">退出</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
<div class="main-content">
|
||||||
|
<main class="dashboard-grid">
|
||||||
|
<section class="card card__profile">个人卡片区域</section>
|
||||||
|
<section class="card card__rss">RSS News区域</section>
|
||||||
|
<section class="card card__task">任务区域</section>
|
||||||
|
<section class="card card__hitokoto">一言</section>
|
||||||
|
<section class="card card__photos">Photos 区域</section>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
grid-study/src/avatar_240.webp
Normal file
BIN
grid-study/src/avatar_240.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
grid-study/src/avatar_48.png
Normal file
BIN
grid-study/src/avatar_48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
BIN
grid-study/src/favicon.ico
Normal file
BIN
grid-study/src/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
166
grid-study/styles.css
Normal file
166
grid-study/styles.css
Normal file
|
|
@ -0,0 +1,166 @@
|
||||||
|
html, body { height: 100%; }
|
||||||
|
body {
|
||||||
|
/* 使用 Bing 图片作为背景 */
|
||||||
|
background-image: url('src/wallpaper/big_sure.jpg');
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-attachment: fixed;
|
||||||
|
|
||||||
|
/* 保持高度设置 */
|
||||||
|
min-height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 顶栏样式 */
|
||||||
|
.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: 40px auto;
|
||||||
|
padding: 0 20px 40px 20px;
|
||||||
|
}
|
||||||
|
.dashboard-grid{
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
grid-auto-rows: minmax(200px, 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;
|
||||||
|
margin-bottom: 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__rss{
|
||||||
|
grid-column: span 2;
|
||||||
|
grid-row: span 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__hitokoto{
|
||||||
|
grid-column: span 1;
|
||||||
|
grid-row: span 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__photo{
|
||||||
|
grid-column: span 1;
|
||||||
|
grid-row: span 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card__task{
|
||||||
|
grid-column: span 2;
|
||||||
|
grid-row: span 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 响应式设计 */
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.dashboard-grid {
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.dashboard-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
grid-column: span 1 !important;
|
||||||
|
grid-row: auto !important;
|
||||||
|
order: 10;
|
||||||
|
}
|
||||||
|
.card__profile{
|
||||||
|
grid-column: span 1;
|
||||||
|
order: 1;
|
||||||
|
}
|
||||||
|
.card__rss,.card__task{
|
||||||
|
grid-column: span 1;
|
||||||
|
}
|
||||||
|
.card__hitokoto{
|
||||||
|
order: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue