Template:HomePage/styles.css
模板页面
更多操作
/* --- 1. 全局与布局 --- */
/* 页面背景 (仅在主页生效) */
body.page-Main_Page, body.page-首页 { /* 确保样式只应用在首页 */
background-color: #1a232b; /* 深色太空背景 */
color: #e0e0e0;
}
/* 内容区域重置 (仅在主页生效) */
body.page-Main_Page #content, body.page-首页 #content {
background: none;
border: none;
box-shadow: none;
}
/* 首页网格容器 */
.home-grid-container {
max-width: 1400px;
margin: 20px auto;
display: grid;
/* 定义网格为6列,fr单位代表按比例分配可用空间 */
grid-template-columns: repeat(6, 1fr);
gap: 15px; /* 网格间距 */
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* --- 2. 卡片通用样式 --- */
/* 首页卡片基础样式 */
.home-card {
background-color: #2c3a47; /* 卡片背景色 */
border-radius: 8px;
padding: 20px;
border: 1px solid #4a5a6a;
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
display: flex;
flex-direction: column;
}
/* 卡片悬浮效果 */
.home-card:hover {
transform: translateY(-3px);
box-shadow: 0 5px 15px rgba(52, 152, 219, 0.2);
border-color: #3498db;
}
/* 卡片内部元素 */
.home-card .card-label {
font-size: 12px;
font-weight: bold;
text-transform: uppercase;
color: #9ab;
margin-bottom: 5px;
}
.home-card .card-header {
font-size: 22px;
font-weight: bold;
color: #ffffff;
margin: 0 0 15px 0;
}
.home-card .card-header a {
color: inherit;
text-decoration: none;
transition: color 0.2s ease;
}
.home-card .card-header a:hover {
color: #3498db;
}
.home-card .card-content {
flex-grow: 1; /* 内容区自动占据剩余空间 */
font-size: 14px;
line-height: 1.6;
}
/* 网格跨度控制 */
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.row-span-2 { grid-row: span 2; }
/* --- 3. 特定模块样式 --- */
/* 3.1 欢迎与搜索框 */
.home-search-card {
/* 您可以在此设置背景图,如果不用图片则会显示纯色 */
/* background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('YOUR_BANNER_IMAGE.png') center center / cover no-repeat; */
background-color: #34495e;
padding: 30px 20px;
align-items: center;
justify-content: center;
text-align: center;
}
.home-search-card .search-title {
font-size: 32px;
font-weight: bold;
color: #ffffff;
text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
margin: 0 0 10px 0;
}
.home-search-card .inputbox { /* MediaWiki生成的搜索框容器 */
width: 90%;
max-width: 600px;
margin: 0 auto;
}
.home-search-card .inputbox-input {
padding: 12px 15px;
font-size: 16px;
border: 2px solid #3498db;
border-radius: 6px 0 0 6px;
outline: none;
color: #333; /* 输入文字颜色 */
}
.home-search-card .inputbox-button {
padding: 12px 20px;
font-size: 16px;
background-color: #3498db;
color: white;
font-weight: bold;
border: 2px solid #3498db;
border-left: none;
border-radius: 0 6px 6px 0;
cursor: pointer;
transition: background-color 0.2s ease;
}
.home-search-card .inputbox-button:hover {
background-color: #2980b9;
}
/* 3.2 快速导航按钮 */
.card-button-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 10px;
}
.card-button {
display: block;
background-color: #3e5060;
color: #e0e0e0;
padding: 10px;
text-align: center;
border-radius: 5px;
text-decoration: none;
font-weight: bold;
transition: background-color 0.2s ease, color 0.2s ease;
}
.card-button:hover {
background-color: #3498db;
color: #ffffff;
}
/* 3.3 当月生日角色列表 */
.birthday-character-list {
display: flex;
flex-wrap: wrap;
gap: 15px;
}
.character-item {
display: flex;
align-items: center;
gap: 10px;
background-color: #3e5060;
padding: 8px;
border-radius: 6px;
min-width: 180px;
flex-grow: 1; /* 让项目能自动填充空间 */
}
.character-item img {
border-radius: 50%;
border: 2px solid #3498db;
background-color: #2c3a47;
}
.character-item span {
font-size: 14px;
line-height: 1.3;
}
.character-item a {
color: #fff;
font-weight: bold;
text-decoration: none;
}
.character-item small {
color: #9ab;
font-size: 12px;
}
/* 3.4 官方链接 */
.official-links-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
}
.official-link-button {
display: block;
background-color: #3e5060;
color: #e0e0e0;
padding: 10px;
text-align: center;
border-radius: 5px;
text-decoration: none;
transition: background-color 0.2s ease;
font-weight: bold;
}
.official-link-button:hover {
background-color: #3498db;
color: #ffffff;
}
/* --- 4. 响应式设计 (可选,但强烈推荐) --- */
/* 当屏幕宽度小于900px时,网格变为3列 */
@media (max-width: 900px) {
.home-grid-container {
grid-template-columns: repeat(3, 1fr);
}
}
/* 当屏幕宽度小于600px时,网格变为1列 */
@media (max-width: 600px) {
.home-grid-container {
grid-template-columns: 1fr;
}
/* 在单列视图下,所有卡片都应该横跨整列,所以重置跨度 */
.home-card {
grid-column: span 1 !important;
grid-row: auto !important;
}
}