Files
unicut/src/pages/article/article.module.less
T

408 lines
6.9 KiB
Plaintext
Raw 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.
.page {
min-height: 100vh;
display: flex;
flex-direction: column;
background: #f5f6fa;
}
// 三栏布局:左浮动目录 + 正文 + 右浮动「更多教程」
.layout {
flex: 1;
width: 100%;
max-width: none; // 自适应全屏,不再锁 1440
margin: 0 auto;
padding: 92px 28px 72px; // 顶部让开 fixed 导航(60px)+ 间距
display: flex;
align-items: flex-start;
justify-content: center;
gap: 28px;
}
.main {
flex: 1;
min-width: 0;
max-width: none; // 主体自适应吃满剩余宽度,不再锁 940
}
.tip {
padding: 24px;
background: #fff;
border: 1px solid #e4e6eb;
border-radius: 12px;
color: #5f6368;
font-size: 14px;
line-height: 1.8;
a {
color: #202124;
font-weight: 600;
}
}
.article {
padding: 40px 48px 48px;
background: #fff;
border: 1px solid #e8eaed;
border-radius: 14px;
box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
}
.meta {
margin: 0 0 6px;
color: #9aa0a6;
font-size: 13px;
}
// ---------- 左侧浮动目录 ----------
.toc {
position: sticky;
top: 76px; // fixed 导航 60px + 16px 间距
flex-shrink: 0;
width: 224px;
max-height: calc(100vh - 108px);
overflow-y: auto;
padding: 18px 16px 18px 0;
}
.tocTitle {
margin: 0 0 10px 14px;
font-size: 12px;
font-weight: 700;
letter-spacing: 0.12em;
color: #9aa0a6;
}
.tocList {
margin: 0;
padding: 0 0 0 2px;
list-style: none;
border-left: 2px solid #e8eaed;
li a {
display: block;
padding: 7px 8px 7px 14px;
margin-left: -2px;
border-left: 2px solid transparent;
color: #5f6368;
font-size: 13.5px;
line-height: 1.55;
text-decoration: none;
border-radius: 0 8px 8px 0;
transition: color 0.15s, border-color 0.15s, background 0.15s;
&:hover {
color: #1a73e8;
background: #f0f6ff;
}
}
li.lvl3 a {
padding-left: 30px;
font-size: 13px;
color: #80868b;
}
li a.active {
color: #1a73e8;
font-weight: 600;
border-left-color: #1a73e8;
background: #f0f6ff;
}
}
// ---------- 右侧浮动「更多教程」----------
.related {
position: sticky;
top: 76px;
flex-shrink: 0;
width: 256px;
padding: 20px 20px 12px;
background: #fff;
border: 1px solid #e8eaed;
border-radius: 14px;
box-shadow: 0 1px 3px rgba(16, 24, 40, 0.05);
h3 {
margin: 0 0 6px;
font-size: 15px;
font-weight: 700;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
li {
display: block;
padding: 11px 10px;
margin: 0 -10px;
border-top: 1px solid #f1f3f4;
border-radius: 8px;
font-size: 14px;
&:first-child {
border-top: none;
}
&:hover {
background: #f7f9fc;
}
a {
display: block;
color: #202124;
font-weight: 600;
line-height: 1.5;
text-decoration: none;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
&:hover {
color: #1a73e8;
}
}
}
}
.desc {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
color: #9aa0a6;
font-size: 12.5px;
line-height: 1.6;
margin-top: 3px;
overflow: hidden;
}
// ---------- 正文排版 ----------
.md {
font-size: 16px;
line-height: 2;
color: #2b2d31;
word-break: break-word;
:global {
h1 {
font-size: 30px;
font-weight: 800;
line-height: 1.4;
letter-spacing: -0.01em;
margin: 0 0 14px;
color: #0f1419;
}
h2 {
font-size: 23px;
font-weight: 700;
line-height: 1.45;
margin: 52px 0 18px;
padding-bottom: 12px;
border-bottom: 0;
background: linear-gradient(90deg, #1a73e8, rgba(26, 115, 232, 0)) no-repeat left bottom / 100% 2px;
color: #0f1419;
scroll-margin-top: 84px; // 锚点跳转让开 fixed 导航
}
h3 {
font-size: 18.5px;
font-weight: 700;
line-height: 1.5;
margin: 38px 0 14px;
color: #1f2328;
scroll-margin-top: 84px;
}
h4,
h5,
h6 {
margin: 30px 0 12px;
font-weight: 700;
}
p {
margin: 20px 0;
}
ul,
ol {
margin: 18px 0;
padding-left: 1.6em;
}
li {
margin: 10px 0;
line-height: 1.95;
&::marker {
color: #1a73e8;
}
}
li p {
margin: 6px 0;
}
strong {
font-weight: 700;
color: #0f1419;
}
code {
background: #f4f5f7;
border: 1px solid #eceef1;
border-radius: 6px;
padding: 2px 7px;
font-size: 14.5px;
color: #c7254e;
}
pre {
background: #101828;
border: 1px solid #1d2939;
border-radius: 12px;
padding: 20px 22px;
overflow: auto;
margin: 24px 0;
line-height: 1.75;
code {
background: none;
border: none;
padding: 0;
color: #d0d5dd;
font-size: 14px;
}
}
blockquote {
margin: 24px 0;
padding: 14px 22px;
background: #eef4fd;
border-left: 4px solid #1a73e8;
border-radius: 0 10px 10px 0;
color: #3c4043;
font-size: 15.5px;
p {
margin: 8px 0;
}
strong {
color: #174ea6;
}
}
table {
border-collapse: collapse;
width: 100%;
margin: 26px 0;
border: 1px solid #e8eaed;
border-radius: 10px;
overflow: hidden;
font-size: 15px;
th {
background: #f6f8fa;
font-weight: 700;
color: #0f1419;
padding: 11px 16px;
border: 1px solid #e8eaed;
text-align: left;
}
td {
padding: 11px 16px;
border: 1px solid #e8eaed;
line-height: 1.7;
}
tr:nth-child(even) td {
background: #fafbfc;
}
}
hr {
border: 0;
border-top: 1px solid #e8eaed;
margin: 48px 0;
}
img {
display: block;
max-width: 100%;
margin: 30px auto;
border: 1px solid #e4e7ec;
border-radius: 10px;
box-shadow: 0 6px 22px rgba(15, 20, 25, 0.10);
}
// 图片段落:整段居中,同段软换行的斜体作图注
p:has(> img) {
text-align: center;
margin: 34px 0 6px;
em {
display: block;
margin-top: 12px;
color: #9aa0a6;
font-size: 13.5px;
line-height: 1.6;
text-align: center;
}
}
a {
color: #1a73e8;
&:hover {
text-decoration: underline;
}
}
}
}
// ---------- 窄屏:收起两侧浮动面板,恢复单栏 ----------
@media (max-width: 1280px) {
.layout {
flex-wrap: wrap;
padding: 84px 16px 56px;
}
.toc {
display: none;
}
.main {
max-width: 100%;
}
.related {
position: static;
width: 100%;
margin-top: 4px;
}
.article {
padding: 28px 22px 36px;
}
.md {
font-size: 15.5px;
:global {
h1 {
font-size: 25px;
}
h2 {
font-size: 21px;
margin-top: 40px;
}
}
}
}