跳转到内容
打开/关闭菜单
  • 397 文件
  • 3 用户
  • 6144 编辑
Gal中文百科
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

Template:角色卡片/styles.css:修订间差异

模板页面
更多语言
Yexiaoyu留言 | 贡献
无编辑摘要
Yexiaoyu留言 | 贡献
无编辑摘要
标签已被回退
第1行: 第1行:
/* ============================================================
  模板:角色卡片/styles.css
  ------------------------------------------------------------
  注意事项:
  1. TemplateStyles 不支持 CSS 变量(phab:T320322),
      var() 前均写一行字面色值兜底。
  2. 缩略项用 inline-block 的 span,条目里无需额外包容器,
      多个模板并列会自然排成一行,也不会被 wikitext 拆段。
  3. 弹窗靠 :target 驱动,关闭链接指向页面上不存在的
      #cc-close —— 目标不存在且不是 #top 时浏览器不滚动,
      因此关闭后视口停在原处。
  ============================================================ */
/* ---------- 卡片本体 ---------- */
.character-card {
.character-card {
display: flex;
    display: flex;
flex-wrap: wrap;
    width: 100%;
width: 100%;
    flex-wrap: wrap;
min-height: 280px;
    min-height: 280px;
margin: 15px 5px;
    border-radius: 10px;
border-radius: 10px;
    overflow: hidden;
overflow: hidden;
    background-color: var(--chara-card-color);
background-color: #ffffff;
    box-shadow:
background-color: var( --chara-card-color );
        0 5px 11px rgb(0 0 0 / 18%),
box-shadow: 0 5px 11px rgba( 0, 0, 0, 0.18 ), 0 4px 15px rgba( 0, 0, 0, 0.15 );
        0 4px 15px rgb(0 0 0 / 15%);
    margin: 15px 5px;
}
}
.character-card__portrait {
.character-card__portrait {
position: relative;
    width: 30%;
width: 30%;
    position: relative;
overflow: hidden;
    overflow: hidden;
background-color: #f8f9fa;
    background-color: var(--color-surface-0);
background-color: var( --color-surface-0 );
}
}
.character-card__body {
.character-card__body {
width: 70%;
    width: 70%;
padding: 1rem;
    padding: 1rem;
box-sizing: border-box;
    box-sizing: border-box;
}
}
.character-card__name {
.character-card__name {
display: flex;
    font-size: 150%;
    font-weight: bold;
    display: flex;
flex-wrap: wrap;
flex-wrap: wrap;
align-items: baseline;
align-items: baseline;
gap: 0;
gap: 0;
font-size: 150%;
font-weight: bold;
}
}
.character-card__name-original {
.character-card__name-original {
margin-left: -0.1em;
font-size: 0.65em;
font-size: 0.65em;
font-weight: normal;
font-weight: normal;
opacity: 0.7;
white-space: nowrap;
white-space: nowrap;
opacity: 0.7;
margin-left: -0.1em;
}
}
.character-card__name-original::before {
.character-card__name-original::before {
content: "(";
content: "(";
}
}
.character-card__name-original::after {
.character-card__name-original::after {
content: ")";
content: ")";
}
}
 
.character-card__header {
}
.character-card__cv {
.character-card__cv {
font-style: italic;
    font-style: italic;
}
}
 
.character-card__divider {
 
    margin: 1rem 0;
/* ---------- 属性区 ---------- */
    border: 0;
 
    border-top: 1px solid rgba(0, 0, 0, .1);
}
/* 角色属性区 */
.character-card__meta {
.character-card__meta {
display: flex;
display: flex;
flex-wrap: wrap;
    flex-wrap: wrap;
gap: 0.4rem 0.6rem;
    gap: .4rem .6rem;
margin: 0.5rem 0;
    margin: 0.5rem 0;
font-size: 82%;
    font-size: 82%;
}
}
.character-card__meta .chip {
.character-card__meta .chip {
padding: 2px 9px;
    border: 1px solid rgba(0, 0, 0, .12);
border: 1px solid rgba( 0, 0, 0, 0.12 );
    border-radius: 6px;
border-radius: 6px;
    padding: 2px 9px;
color: #555555;
    color: #555;
}
}
.character-card__meta .chip b {
.character-card__meta .chip b {
margin-right: 0.2rem;
    margin-right: 0.2rem;
}
}
 
/* 立绘 */
 
/* ---------- 立绘轮播(Module:角色立绘 输出) ---------- */
 
.portrait-slides {
.portrait-slides {
position: absolute;
    width: 100%;
top: 0;
    height: 100%;
right: 0;
    position: absolute;
bottom: 0;
    inset: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.portrait-slide {
.portrait-slide {
position: absolute;
    position: absolute;
top: 0;
    inset: 0;
right: 0;
    opacity: 0;
bottom: 0;
    transition: opacity .25s ease;
left: 0;
opacity: 0;
transition: opacity 250ms ease;
}
}
.portrait-slide.active {
.portrait-slide.active {
z-index: 1;
    opacity: 1;
opacity: 1;
    z-index: 1;
}
}
.portrait-slide img {
.portrait-slide img {
width: 100%;
    width: 100%;
height: 100%;
    height: 100%;
object-fit: cover;
    object-fit: cover;
object-position: top center;
    object-position: top center;
}
}
.portrait-label {
.portrait-label {
position: absolute;
    position: absolute;
bottom: 10px;
    bottom: 10px;
left: 10px;
    left: 10px;
padding: 3px 10px;
    padding: 3px 10px;
border-radius: 5px;
    background: rgba(0, 0, 0, .5);
background: rgba( 0, 0, 0, 0.5 );
    color: white;
color: #ffffff;
    border-radius: 5px;
font-size: 12px;
    font-size: 12px;
}
}
.character-card__switch {
.character-card__switch {
position: absolute;
    position: absolute;
top: 10px;
    z-index: 5;
right: 10px;
    right: 10px;
z-index: 5;
    top: 10px;
display: flex;
    width: 30px;
align-items: center;
    height: 30px;
justify-content: center;
    display: flex;
width: 30px;
    align-items: center;
height: 30px;
    justify-content: center;
border-radius: 50%;
    border-radius: 50%;
background: rgba( 0, 0, 0, 0.5 );
    background: rgba(0, 0, 0, .5);
color: #ffffff;
    color: white;
cursor: pointer;
    cursor: pointer;
}
}
 
/* 左右布局 */
 
/* ---------- 立绘居右 ---------- */
 
.character-card--layout-2 .character-card__portrait {
.character-card--layout-2 .character-card__portrait {
order: 2;
    order: 2;
}
}
.character-card--layout-2 .character-card__body {
.character-card--layout-2 .character-card__body {
order: 1;
    order: 1;
}
/* 响应式 */
@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;
}
}
}


/* ========================================================
  弹窗布局(主体样式=3)
  ======================================================== */


/* ---------- 画廊缩略项 ---------- */
/* 缩略触发块的网格容器:宽屏固定 6 列,窄屏逐级降级 */
.character-card-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}
@media (max-width: 900px) {
    .character-card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 600px) {
    .character-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 420px) {
    .character-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


.character-card-thumb {
/* 触发块:链接由 wikitext [[#id|...]] 生成,这里只重置默认链接样式 */
display: inline-block;
.character-card-thumb-wrap {
vertical-align: top;
    text-align: center;
width: 104px;
margin: 0 4px 6px 0;
padding: 4px;
border: 1px solid #c8ccd1;
border-radius: 4px;
background: #ffffff;
transition: border-color 120ms, box-shadow 120ms;
}
}
 
.character-card-thumb-wrap a {
.character-card-thumb:hover {
    text-decoration: none;
border-color: #3366cc;
    color: inherit;
box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.14 );
    display: inline-block;
    width: 100%;
}
}
 
.character-card-thumb {
.character-card-thumb a {
    display: inline-block;
color: inherit;
    width: 100%;
text-decoration: none;
    max-width: 96px;
    text-align: center;
    vertical-align: top;
}
}
 
.character-card-thumb__avatar {
.character-card-thumb img {
    display: block;
display: block;
    width: 72px;
width: 94px;
    height: 72px;
height: 128px;
    margin: 0 auto .35rem;
object-fit: cover;
    border-radius: 50%;
object-position: top center;
    border: 2px solid rgba(0, 0, 0, .08);
background: #f8f9fa;
    background-color: var(--color-surface-0);
    background-size: cover;
    background-position: top center;
}
}
 
.character-card-thumb-wrap a:hover .character-card-thumb__avatar {
.character-card-thumb__ph {
    border-color: rgba(0, 0, 0, .3);
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 {
.character-card-thumb__name {
display: block;
    display: block;
padding-top: 3px;
    font-size: 82%;
font-size: 0.85em;
    line-height: 1.25;
line-height: 1.35;
    overflow: hidden;
text-align: center;
    text-overflow: ellipsis;
word-break: break-all;
    white-space: nowrap;
}
}


 
/* 弹窗层:基于 :target 显示/隐藏 */
/* ---------- 弹窗 ---------- */
 
.character-card-modal {
.character-card-modal {
display: none;
    display: none;
position: fixed;
    position: fixed;
top: 0;
    inset: 0;
right: 0;
    z-index: 1000;
bottom: 0;
left: 0;
z-index: 1000;
align-items: center;
justify-content: center;
padding: 20px;
box-sizing: border-box;
}
}
.character-card-modal:target {
.character-card-modal:target {
display: flex;
    display: block;
}
}
.character-card-modal__overlay {
.character-card-modal__overlay {
position: absolute;
    position: absolute;
top: 0;
    inset: 0;
right: 0;
bottom: 0;
left: 0;
}
}
.character-card-modal__overlay a {
.character-card-modal__overlay a {
display: block;
    display: block;
width: 100%;
    width: 100%;
height: 100%;
    height: 100%;
background: rgba( 0, 0, 0, 0.6 );
    background: rgba(0, 0, 0, .6);
}
}
.character-card-modal__box {
.character-card-modal__box {
position: relative;
    position: relative;
z-index: 1;
    z-index: 1;
width: 100%;
    width: 92%;
max-width: 640px;
    max-width: 640px;
max-height: 86vh;
    max-height: 86vh;
margin: 0;
    overflow: auto;
overflow: auto;
    margin: 5vh auto;
border-radius: 10px;
    background-color: var(--chara-card-color);
background-color: #ffffff;
    border-radius: 10px;
background-color: var( --chara-card-color );
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
box-shadow: 0 10px 30px rgba( 0, 0, 0, 0.35 );
}
}
.character-card-modal__box .character-card {
.character-card-modal__box .character-card {
margin: 0;
    margin: 0;
min-height: 0;
    box-shadow: none;
box-shadow: none;
    min-height: 0;
}
}
.character-card-modal__close {
.character-card-modal__close {
position: absolute;
    position: absolute;
top: 8px;
    top: 8px;
right: 12px;
    right: 12px;
z-index: 2;
    z-index: 2;
}
}
.character-card-modal__close a {
.character-card-modal__close a {
display: flex;
    display: flex;
align-items: center;
    width: 30px;
justify-content: center;
    height: 30px;
width: 30px;
    align-items: center;
height: 30px;
    justify-content: center;
border-radius: 50%;
    border-radius: 50%;
background: rgba( 0, 0, 0, 0.5 );
    background: rgba(0, 0, 0, .5);
color: #ffffff;
    color: #fff;
font-size: 18px;
    text-decoration: none;
line-height: 1;
    font-size: 18px;
text-decoration: none;
    line-height: 1;
}
}
.character-card-modal__close a:hover {
.character-card-modal__close a:hover {
background: rgba( 0, 0, 0, 0.75 );
    background: rgba(0, 0, 0, .75);
}
}
.character-card-modal__more {
.character-card-modal__more {
padding: 0 1rem 1rem;
    padding: 0 1rem 1rem;
font-weight: bold;
    text-align: right;
text-align: right;
    font-weight: bold;
}
 
 
/* ---------- 窄屏 ---------- */
 
@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;
}
}
}

2026年8月29日 (六) 08:01的版本

.character-card {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    min-height: 280px;
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--chara-card-color);
    box-shadow:
        0 5px 11px rgb(0 0 0 / 18%),
        0 4px 15px rgb(0 0 0 / 15%);
    margin: 15px 5px;
}
.character-card__portrait {
    width: 30%;
    position: relative;
    overflow: hidden;
    background-color: var(--color-surface-0);
}
.character-card__body {
    width: 70%;
    padding: 1rem;
    box-sizing: border-box;
}
.character-card__name {
    font-size: 150%;
    font-weight: bold;
    display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0;
}
.character-card__name-original {
	font-size: 0.65em;
	font-weight: normal;
	opacity: 0.7;
	white-space: nowrap;
	margin-left: -0.1em;
}
.character-card__name-original::before {
	content: "(";
}
.character-card__name-original::after {
	content: ")";
}
.character-card__header {
}
.character-card__cv {
    font-style: italic;
}
.character-card__divider {
    margin: 1rem 0;
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, .1);
}
/* 角色属性区 */
.character-card__meta {
	display: flex;
    flex-wrap: wrap;
    gap: .4rem .6rem;
    margin: 0.5rem 0;
    font-size: 82%;
}
.character-card__meta .chip {
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 6px;
    padding: 2px 9px;
    color: #555;
}
.character-card__meta .chip b {
    margin-right: 0.2rem;
}
/* 立绘 */
.portrait-slides {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}
.portrait-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .25s ease;
}
.portrait-slide.active {
    opacity: 1;
    z-index: 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;
    background: rgba(0, 0, 0, .5);
    color: white;
    border-radius: 5px;
    font-size: 12px;
}
.character-card__switch {
    position: absolute;
    z-index: 5;
    right: 10px;
    top: 10px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    color: white;
    cursor: pointer;
}
/* 左右布局 */
.character-card--layout-2 .character-card__portrait {
    order: 2;
}
.character-card--layout-2 .character-card__body {
    order: 1;
}
/* 响应式 */
@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;
	}
}

/* ========================================================
   弹窗布局(主体样式=3)
   ======================================================== */

/* 缩略触发块的网格容器:宽屏固定 6 列,窄屏逐级降级 */
.character-card-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin: 1rem 0;
}
@media (max-width: 900px) {
    .character-card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (max-width: 600px) {
    .character-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 420px) {
    .character-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 触发块:链接由 wikitext [[#id|...]] 生成,这里只重置默认链接样式 */
.character-card-thumb-wrap {
    text-align: center;
}
.character-card-thumb-wrap a {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    width: 100%;
}
.character-card-thumb {
    display: inline-block;
    width: 100%;
    max-width: 96px;
    text-align: center;
    vertical-align: top;
}
.character-card-thumb__avatar {
    display: block;
    width: 72px;
    height: 72px;
    margin: 0 auto .35rem;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, .08);
    background-color: var(--color-surface-0);
    background-size: cover;
    background-position: top center;
}
.character-card-thumb-wrap a:hover .character-card-thumb__avatar {
    border-color: rgba(0, 0, 0, .3);
}
.character-card-thumb__name {
    display: block;
    font-size: 82%;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 弹窗层:基于 :target 显示/隐藏 */
.character-card-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}
.character-card-modal:target {
    display: block;
}
.character-card-modal__overlay {
    position: absolute;
    inset: 0;
}
.character-card-modal__overlay a {
    display: block;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .6);
}
.character-card-modal__box {
    position: relative;
    z-index: 1;
    width: 92%;
    max-width: 640px;
    max-height: 86vh;
    overflow: auto;
    margin: 5vh auto;
    background-color: var(--chara-card-color);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.character-card-modal__box .character-card {
    margin: 0;
    box-shadow: none;
    min-height: 0;
}
.character-card-modal__close {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 2;
}
.character-card-modal__close a {
    display: flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
}
.character-card-modal__close a:hover {
    background: rgba(0, 0, 0, .75);
}
.character-card-modal__more {
    padding: 0 1rem 1rem;
    text-align: right;
    font-weight: bold;
}