Template:角色卡片/styles.css
模板页面
更多语言
更多操作
.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;
}
}
/* 弹窗触发缩略块 */
.character-card-grid {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin: 1rem 0;
}
.character-card-thumb {
width: 88px;
text-align: center;
}
.character-card-thumb__link {
display: block;
text-decoration: none;
color: inherit;
}
.character-card-thumb__avatar {
display: block;
width: 72px;
height: 72px;
margin: 0 auto .35rem;
border-radius: 50%;
overflow: hidden;
border: 2px solid rgba(0, 0, 0, .08);
background-color: var(--color-surface-0);
}
.character-card-thumb__avatar img {
width: 100%;
height: 100%;
object-fit: cover;
object-position: top center;
}
.character-card-thumb__link: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;
}
/* 弹窗层 */
.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;
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;
width: 30px;
height: 30px;
display: flex;
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:hover {
background: rgba(0, 0, 0, .75);
}
.character-card-modal__more {
padding: 0 1rem 1rem;
text-align: right;
font-weight: bold;
}
.character-card-grid {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin: 1rem 0;
}
/* 触发块:链接由 wikitext 生成,这里只重置默认样式 */
.character-card-thumb-wrap a {
text-decoration: none;
color: inherit;
}
.character-card-thumb {
display: inline-block;
width: 88px;
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;
}
/* 弹窗层 */
.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;
}