模板:PageBanner/styles.css:修订间差异
来自Blockland Wiki
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
/* --- 1. 暴力隐藏 Citizen 及原生标题 --- */ | /* --- 1. 暴力隐藏 Citizen 及原生标题 --- */ | ||
/* 针对 Citizen 皮肤的特殊标题结构 */ | |||
.citizen-page-header, | |||
.mw-body-header, | .mw-body-header, | ||
. | header.mw-body-header, | ||
#firstHeading, | #firstHeading, | ||
.firstHeading, | .firstHeading, | ||
.page-heading { | .page-heading { | ||
display: none !important; | display: none !important; | ||
} | } | ||
/* | /* 修正隐藏标题后顶部留出的大白条 */ | ||
.mw-body, #content { | .mw-body, #content, #bodyContent { | ||
margin-top: 0 !important; | margin-top: 0 !important; | ||
padding-top: 0 !important; | padding-top: 0 !important; | ||
| 第17行: | 第19行: | ||
.page-banner { | .page-banner { | ||
position: relative; | position: relative; | ||
height: | height: 400px; /* 稍微改小了一点,显得更紧凑 */ | ||
width: 100%; | width: 100%; | ||
margin-top: - | /* 这里的 margin 是为了抵消 Citizen 默认的边距 */ | ||
margin-top: -1rem; | |||
margin-left: 0; | |||
margin-right: 0; | |||
margin-bottom: 2rem; | margin-bottom: 2rem; | ||
z-index: 0; | z-index: 0; | ||
overflow: hidden; /* 防止图片溢出 */ | |||
border-radius: 4px; /* 给整个 Banner 一点圆角 */ | |||
} | } | ||
/* --- 3. | /* --- 3. 背景层 (支持 [[File:...]] 语法的核心) --- */ | ||
.page-banner-bg { | .page-banner-bg { | ||
position: absolute; | position: absolute; | ||
top: 0; | top: 0; | ||
left: 0; | |||
width: 100%; | |||
height: 100%; | height: 100%; | ||
z-index: -2; | z-index: -2; | ||
} | |||
/* 关键:让 wiki 插入的 img 标签撑满容器 */ | |||
.page-banner-bg img { | |||
width: 100% !important; | |||
height: 100% !important; | |||
object-fit: cover !important; /* 裁剪图片以填充,不拉伸 */ | |||
object-position: center center; | |||
} | } | ||
| 第44行: | 第53行: | ||
position: absolute; | position: absolute; | ||
top: 0; | top: 0; | ||
left: 0; | |||
width: 100%; | |||
height: 100%; | height: 100%; | ||
/* 渐变:顶部稍微暗一点,底部变黑以突出文字 */ | |||
background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.6) 100%); | |||
/* | |||
background: linear-gradient(to bottom, rgba(0,0,0,0. | |||
z-index: -1; | z-index: -1; | ||
} | } | ||
| 第60行: | 第66行: | ||
height: 100%; | height: 100%; | ||
width: 100%; | width: 100%; | ||
box-sizing: border-box; | |||
display: flex; | display: flex; | ||
flex-direction: column; | flex-direction: column; | ||
justify-content: flex-end; | justify-content: flex-end; /* 文字沉底 */ | ||
align-items: flex-start; | align-items: flex-start; /* 文字靠左 */ | ||
padding: 2rem; /* 内边距 */ | |||
padding | |||
z-index: 1; | z-index: 1; | ||
} | } | ||
/* --- 6. 文字样式 | /* --- 6. 文字样式 --- */ | ||
.page-banner-local { | .page-banner-local { | ||
font-family: 'Microsoft YaHei', 'SimHei', sans-serif; /* 无衬线 */ | |||
font-family: | font-size: 3.5em; | ||
font-size: | |||
font-weight: 900; | font-weight: 900; | ||
color: #ffffff; | color: #ffffff; | ||
line-height: 1.1; | line-height: 1.1; | ||
margin: 0; | margin: 0; | ||
text-shadow: 0 2px 10px rgba(0,0,0,0.8); | |||
text-shadow: 0 | |||
} | } | ||
.page-banner-en { | .page-banner-en { | ||
font-family: | font-family: sans-serif; | ||
font-size: 1. | font-size: 1.2em; | ||
font-weight: 500; | font-weight: 500; | ||
color: rgba(255, 255, 255, 0.9); | color: rgba(255, 255, 255, 0.9); | ||
margin-top: | margin-top: 5px; | ||
text-transform: uppercase; | text-transform: uppercase; | ||
text-shadow: 0 | text-shadow: 0 1px 5px rgba(0,0,0,0.8); | ||
} | } | ||
2026年1月30日 (五) 16:40的版本
/* --- 1. 暴力隐藏 Citizen 及原生标题 --- */
/* 针对 Citizen 皮肤的特殊标题结构 */
.citizen-page-header,
.mw-body-header,
header.mw-body-header,
#firstHeading,
.firstHeading,
.page-heading {
display: none !important;
}
/* 修正隐藏标题后顶部留出的大白条 */
.mw-body, #content, #bodyContent {
margin-top: 0 !important;
padding-top: 0 !important;
}
/* --- 2. Banner 主容器 --- */
.page-banner {
position: relative;
height: 400px; /* 稍微改小了一点,显得更紧凑 */
width: 100%;
/* 这里的 margin 是为了抵消 Citizen 默认的边距 */
margin-top: -1rem;
margin-left: 0;
margin-right: 0;
margin-bottom: 2rem;
z-index: 0;
overflow: hidden; /* 防止图片溢出 */
border-radius: 4px; /* 给整个 Banner 一点圆角 */
}
/* --- 3. 背景层 (支持 [[File:...]] 语法的核心) --- */
.page-banner-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -2;
}
/* 关键:让 wiki 插入的 img 标签撑满容器 */
.page-banner-bg img {
width: 100% !important;
height: 100% !important;
object-fit: cover !important; /* 裁剪图片以填充,不拉伸 */
object-position: center center;
}
/* --- 4. 渐变遮罩层 --- */
.page-banner-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
/* 渐变:顶部稍微暗一点,底部变黑以突出文字 */
background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.6) 100%);
z-index: -1;
}
/* --- 5. 内容层 --- */
.page-banner-content {
position: relative;
height: 100%;
width: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: flex-end; /* 文字沉底 */
align-items: flex-start; /* 文字靠左 */
padding: 2rem; /* 内边距 */
z-index: 1;
}
/* --- 6. 文字样式 --- */
.page-banner-local {
font-family: 'Microsoft YaHei', 'SimHei', sans-serif; /* 无衬线 */
font-size: 3.5em;
font-weight: 900;
color: #ffffff;
line-height: 1.1;
margin: 0;
text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.page-banner-en {
font-family: sans-serif;
font-size: 1.2em;
font-weight: 500;
color: rgba(255, 255, 255, 0.9);
margin-top: 5px;
text-transform: uppercase;
text-shadow: 0 1px 5px rgba(0,0,0,0.8);
}