Files
NiceQuote/assets/card.css

186 lines
4.4 KiB
CSS
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* NiceQuote 2.5 卡片样式
*
* 三种使用场景共用一份:
* 1. 内嵌模式(inline):卡片直接写在正文里,字号、字体、行高全部继承站点主题;
* 2. iframe 模式:body.nq-standalone 下的独立文档,需要自带字体与配色;
* 3. 后台预览:同样走 iframe。
*
* 卡片均为「标题 + 摘要 + 日期」三行结构,不显示左侧缩略图。
*
* 所有类名都以 nq- 开头,不会和主题的 .quote / .card 撞车。
*/
.nq-card {
--nq-bg: rgba(127, 127, 127, .07);
--nq-line: rgba(127, 127, 127, .26);
--nq-thumb: rgba(127, 127, 127, .14);
--nq-muted: rgba(127, 127, 127, .95);
position: relative;
display: flex;
align-items: center;
gap: 12px;
box-sizing: border-box;
margin: 1.1em 0;
padding: 12px 14px;
border: 1px solid var(--nq-line);
border-radius: var(--nq-radius, 10px);
background: var(--nq-bg);
color: inherit;
font-size: inherit;
line-height: 1.5;
text-decoration: none;
transition: border-color .18s ease, background .18s ease;
}
.nq-card:hover,
.nq-card:focus-visible {
border-color: var(--nq-accent, #c0580c);
outline: none;
}
/* 外部链接卡片没有缩略图,回到单列三行 */
.nq-card.nq-url {
display: block;
}
/* 用户引用靠左:主题常给引用块设 text-align 居中,这里强制回左对齐 */
.nq-card.nq-user {
text-align: left;
}
.nq-body {
flex: 1 1 auto;
display: flex;
flex-direction: column;
gap: 3px;
min-width: 0;
}
.nq-url .nq-body {
gap: 4px;
}
.nq-title {
display: block;
color: var(--nq-accent, #c0580c);
font-weight: 500;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
line-clamp: 1;
word-break: break-word;
}
/* 外部链接没有缩略图占位,标题给两行 */
.nq-url .nq-title {
-webkit-line-clamp: 2;
line-clamp: 2;
}
.nq-desc {
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
font-size: .92em;
opacity: .82;
word-break: break-word;
}
.nq-meta {
overflow: hidden;
color: var(--nq-muted);
font-size: .8em;
white-space: nowrap;
text-overflow: ellipsis;
}
.nq-missing {
display: inline-block;
padding: 2px 8px;
border: 1px dashed var(--nq-line, rgba(127, 127, 127, .4));
border-radius: 6px;
opacity: .7;
font-size: .9em;
}
/* ---------- 连续多张引用:并作一条纵向列表 ---------- */
/* 不加序号、不加「引用 N 篇」标题,只留卡片之间的间距 */
.nq-list {
--nq-line: rgba(127, 127, 127, .26);
--nq-muted: rgba(127, 127, 127, .95);
display: flex;
flex-direction: column;
gap: 8px;
margin: 1.2em 0;
padding: 0;
font-size: inherit;
line-height: 1.5;
}
.nq-list .nq-card {
margin: 0;
}
.nq-list .nq-frame {
margin: 0;
}
/* 明确指定配色时,卡片自己扛起背景与文字色 */
.nq-card.nq-skin-dark {
--nq-bg: rgba(24, 24, 24, .92);
--nq-line: rgba(255, 255, 255, .16);
--nq-thumb: rgba(255, 255, 255, .1);
--nq-muted: rgba(255, 255, 255, .62);
color: #e4e4e4;
}
.nq-card.nq-skin-light {
--nq-bg: rgba(255, 255, 255, .94);
--nq-line: rgba(0, 0, 0, .12);
--nq-thumb: rgba(0, 0, 0, .06);
--nq-muted: rgba(0, 0, 0, .55);
color: #333;
}
/* iframe 独立文档 */
body.nq-standalone {
margin: 0;
padding: 0;
overflow: hidden;
background: transparent;
color: #333;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
"Hiragino Sans GB", "Microsoft YaHei", sans-serif;
font-size: 15px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
body.nq-standalone .nq-card {
margin: 0;
}
body.nq-standalone[data-skin="auto"] {
--nq-bg: #fff;
--nq-line: rgba(0, 0, 0, .12);
--nq-thumb: rgba(0, 0, 0, .06);
--nq-muted: rgba(0, 0, 0, .55);
background: #fff;
}
body.nq-standalone[data-skin="dark"] {
--nq-bg: #191919;
--nq-line: rgba(255, 255, 255, .16);
--nq-thumb: rgba(255, 255, 255, .1);
--nq-muted: rgba(255, 255, 255, .62);
background: #191919;
color: #e4e4e4;
}
body.nq-standalone[data-skin="light"] {
--nq-bg: #fff;
--nq-line: rgba(0, 0, 0, .12);
--nq-muted: rgba(0, 0, 0, .55);
background: #fff;
color: #333;
}
@media (prefers-color-scheme: dark) {
body.nq-standalone[data-skin="auto"] {
--nq-bg: #191919;
--nq-line: rgba(255, 255, 255, .16);
--nq-thumb: rgba(255, 255, 255, .1);
--nq-muted: rgba(255, 255, 255, .62);
background: #191919;
color: #e4e4e4;
}
}
@media (max-width: 480px) {
.nq-card {
gap: 10px;
padding: 10px 12px;
}
}