模板:PageBanner/styles.css
来自Blockland Wiki
更多操作
/* --- 1. 隐藏 Citizen 原生标题 --- */
.mw-body-header {
display: none !important;
}
/* --- 2. Banner 主容器 --- */
.page-banner {
position: relative;
/* 高度 */
height: 450px;
/* 抵消顶部边距 */
margin-top: -1.5rem;
margin-bottom: 2rem;
z-index: 1;
}
/* --- 3. 背景层(修正版) --- */
.page-banner-bg {
position: absolute;
top: 0;
height: 100%;
/* 逃逸逻辑:撑满屏幕 */
width: 100vw;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
background-size: cover;
background-position: center;
z-index: -1;
}
/* === 核心修复:用伪元素模拟“渐隐遮罩” === */
/* 这一层盖在图片上,从透明渐变到页面背景色 */
.page-banner-bg::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
/* Citizen 皮肤变量:--color-surface-1 是正文背景色 */
/* 意思是:上部透明,下部渐变到背景色,实现“融入”效果 */
background: linear-gradient(to bottom, rgba(0,0,0,0) 60%, var(--color-surface-1, #ffffff) 100%);
}
/* --- 4. 内容层 --- */
.page-banner-content {
position: relative;
height: 100%;
max-width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-end; /* 靠下 */
align-items: flex-start; /* 靠左 */
padding-bottom: 80px;
z-index: 2;
}
/* --- 5. 文字样式 --- */
.page-banner-local {
font-family: 'Linux Libertine', 'Georgia', serif;
font-size: 4em;
font-weight: 900;
color: #ffffff;
line-height: 1.1;
margin: 0;
/* 加强阴影,防止在浅色图上看不清 */
text-shadow: 0 4px 15px rgba(0,0,0,0.8);
}
.page-banner-en {
font-family: sans-serif;
font-size: 1.8em;
font-weight: 300;
color: rgba(255, 255, 255, 0.95);
margin-top: 5px;
letter-spacing: 2px;
text-transform: uppercase;
text-shadow: 0 2px 5px rgba(0,0,0,0.9);
}
/* 移动端适配 */
@media screen and (max-width: 720px) {
.page-banner { height: 300px; }
.page-banner-local { font-size: 2.5em; }
.page-banner-en { font-size: 1.2em; }
}