Template:角色卡片/styles.css:修订间差异
模板页面
更多语言
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
/* ---------- 卡片本体 ---------- */ | /* ---------- 卡片本体 ---------- */ | ||
| 第279行: | 第255行: | ||
z-index: 1; | z-index: 1; | ||
width: 100%; | width: 100%; | ||
max-width: | max-width: 720px; | ||
max-height: 86vh; | max-height: 86vh; | ||
margin: 0; | margin: 0; | ||
2026年9月2日 (三) 21:47的最新版本
/* ---------- 卡片本体 ---------- */
.character-card {
display: flex;
flex-wrap: wrap;
width: 100%;
margin: 15px 5px;
border-radius: 10px;
overflow: hidden;
background-color: #ffffff;
background-color: var(--color-surface-1);
box-shadow: 0 5px 11px rgba( 0, 0, 0, 0.18 ), 0 4px 15px rgba( 0, 0, 0, 0.15 );
}
.character-card__portrait {
position: relative;
width: 30%;
overflow: hidden;
background-color: #f8f9fa;
background-color: var( --color-surface-0 );
}
.character-card__body {
width: 70%;
padding: 1rem;
box-sizing: border-box;
}
.character-card__name {
display: flex;
flex-wrap: wrap;
align-items: baseline;
gap: 0;
font-size: 150%;
font-weight: bold;
}
.character-card__name-original {
margin-left: -0.1em;
font-size: 0.65em;
font-weight: normal;
white-space: nowrap;
opacity: 0.7;
}
.character-card__name-original::before {
content: "(";
}
.character-card__name-original::after {
content: ")";
}
.character-card__cv {
font-style: italic;
}
/* ---------- 属性区 ---------- */
.character-card__meta {
display: flex;
flex-wrap: wrap;
gap: 0.4rem 0.6rem;
margin: 0.5rem 0;
font-size: 82%;
}
.character-card__meta .chip {
padding: 2px 9px;
border: 1px solid rgba( 0, 0, 0, 0.12 );
border-radius: 6px;
color: #555555;
}
.character-card__meta .chip b {
margin-right: 0.2rem;
}
/* ---------- 立绘轮播(Module:角色立绘 输出) ---------- */
.portrait-slides {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
}
.portrait-slide {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
opacity: 0;
transition: opacity 250ms ease;
}
.portrait-slide.active {
z-index: 1;
opacity: 1;
}
.portrait-slide img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: top center;
}
.portrait-label {
position: absolute;
bottom: 10px;
left: 10px;
padding: 3px 10px;
border-radius: 5px;
background: rgba( 0, 0, 0, 0.5 );
color: #ffffff;
font-size: 12px;
}
.character-card__switch {
position: absolute;
top: 10px;
right: 10px;
z-index: 5;
display: flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
border-radius: 50%;
background: rgba( 0, 0, 0, 0.5 );
color: #ffffff;
cursor: pointer;
}
/* ---------- 立绘居右 ---------- */
.character-card--layout-2 .character-card__portrait {
order: 2;
}
.character-card--layout-2 .character-card__body {
order: 1;
}
/* ---------- 画廊缩略项 ---------- */
.character-card-thumb {
display: inline-block;
vertical-align: top;
width: 16%;
margin: 0 4px 6px 0;
padding: 4px;
border: 1px solid;
border-radius: 4px;
border-color: var(--border-color-base);
background-color: var(--color-surface-1);
transition: border-color 120ms, box-shadow 120ms;
}
.character-card-thumb:hover {
border-color: #3366cc;
box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.14 );
}
.character-card-thumb a {
color: inherit;
text-decoration: none;
}
.character-card-thumb img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
object-position: top center;
background: #f8f9fa;
aspect-ratio: 1 / 1.4;
}
.character-card-thumb__ph {
display: flex;
align-items: center;
justify-content: center;
width: 94px;
height: 128px;
border: 1px dashed #c8ccd1;
box-sizing: border-box;
background: #f8f9fa;
color: #a2a9b1;
font-size: 0.75em;
text-align: center;
}
.character-card-thumb__name {
display: block;
padding-top: 3px;
font-size: 0.85em;
line-height: 1.35;
text-align: center;
word-break: break-all;
}
/* ---------- 弹窗 ---------- */
.character-card-modal {
display: none;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1000;
align-items: center;
justify-content: center;
padding: 20px;
box-sizing: border-box;
}
.citizen-section--collapsed [hidden="until-found"] .character-card-modal {
display: none !important;
}
[hidden="until-found"].character-card-thumb{
display: none !important;
}
.character-card-modal:target {
display: flex;
}
.character-card-modal__overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.character-card-modal__overlay a {
display: block;
width: 100%;
height: 100%;
background: rgba( 0, 0, 0, 0.6 );
}
.character-card-modal__box {
position: relative;
z-index: 1;
width: 100%;
max-width: 720px;
max-height: 86vh;
margin: 0;
overflow: auto;
border-radius: 10px;
background-color: #ffffff;
background-color: var(--color-surface-1);
box-shadow: 0 10px 30px rgba( 0, 0, 0, 0.35 );
}
.character-card-modal__box .character-card {
margin: 0;
min-height: 0;
box-shadow: none;
}
.character-card-modal__close {
position: absolute;
top: 8px;
right: 12px;
z-index: 2;
}
.character-card-modal__close a {
display: flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
border-radius: 50%;
background: rgba( 0, 0, 0, 0.5 );
color: #ffffff;
font-size: 18px;
line-height: 1;
text-decoration: none;
}
.character-card-modal__close a:hover {
background: rgba( 0, 0, 0, 0.75 );
}
.character-card-modal__more {
padding: 0 1rem 1rem;
font-weight: bold;
text-align: right;
}
/* ---------- 折叠容器内的安全兜底 ----------
见文件头注释第 4 条的原理说明。
下面按几种常见折叠框架的类名做匹配:
- .mw-collapsed MediaWiki 内建 mw-collapsible
- .mw-collapsible.mw-collapsed 同上,双重限定更保险
- .NavFrame.collapsed 旧式 NavFrame 折叠框
- .collapsed 通用/自定义折叠类名(较宽泛)
- .collapsible-block.is-collapsed 部分主题使用的折叠类名
!!请对照你们 wiki 实际使用的折叠框架,把选择器改成/
补充为真实的类名(F12 检查折叠收起时外层容器加的 class)。!!
只要弹窗处在"已折叠"的祖先容器内,就无条件强制隐藏,
不再依赖 :target 是否命中,从根上避免 fixed 弹窗无视
overflow 折叠、铺满全屏挡住点击的问题。 ---------- */
.mw-collapsed .character-card-modal,
.mw-collapsible.mw-collapsed .character-card-modal,
.NavFrame.collapsed .character-card-modal,
.collapsed .character-card-modal,
.collapsible-block.is-collapsed .character-card-modal {
display: none !important;
}
/* 兜底二:万一遮罩因为某种原因仍然显示出来,
至少不要让它把折叠按钮本身也一起挡住无法点击。
这条不能替代上面的隐藏规则,只是最后一道保险。 */
.mw-collapsed .character-card-modal__overlay,
.mw-collapsible.mw-collapsed .character-card-modal__overlay {
pointer-events: none;
}
/* ---------- 窄屏 ---------- */
@media ( max-width: 767px ) {
.character-card__portrait {
width: 100%;
aspect-ratio: 3 / 4;
}
.character-card__body {
width: 100%;
}
.character-card__name {
font-size: 120%;
}
}
@media ( max-width: 480px ) {
.character-card__name-original {
font-size: 0.75em;
}
}