Notes: keep TOC/layout intact, place notes in page margins with adaptive width

This commit is contained in:
2026-11-15 10:14:44 +08:00
parent cfe85f9b16
commit cbe7417fbf
4 changed files with 68 additions and 46 deletions
+9 -20
View File
@@ -255,53 +255,42 @@ html.dark #post-list .post-card:hover {
color: #9ca3af;
}
/* 宽屏:由 notes.js 接管,放进正文两侧的留白 */
/* 宽屏:由 notes.js 接管,放进页面两侧的空白处(不占用正文布局) */
@media (min-width: 80rem) {
/* 去掉 TOC / 侧栏占位后,把正文栏收回原来的阅读宽度,两侧留给注释 */
main.notes-page {
max-width: 52rem;
margin-left: auto;
margin-right: auto;
}
html.js .post-note {
display: none;
}
html.js main.notes-page.notes-active {
html.js main#content.notes-active {
position: relative;
}
html.js main.notes-page.notes-active .post-note.placed {
html.js main#content.notes-active .post-note.placed {
display: block;
position: absolute;
width: 12rem;
margin: 0;
padding: 0 0.75rem;
border: 0 solid #e5e7eb;
border-radius: 0;
background: none;
font-size: 0.8125rem;
line-height: 1.65;
font-size: 0.875rem;
line-height: 1.7;
color: #6b7280;
}
html.dark.js main.notes-page.notes-active .post-note.placed {
html.dark.js main#content.notes-active .post-note.placed {
color: #9ca3af;
border-color: #333;
}
/* 注释靠在正文哪一侧,就在朝向正文的那边加一条细线 */
html.js main.notes-page.notes-active .post-note.placed[data-side="right"] {
left: calc(100% + 1rem);
right: auto;
html.js main#content.notes-active .post-note.placed[data-side="right"] {
border-left-width: 2px;
}
html.js main.notes-page.notes-active .post-note.placed[data-side="left"] {
right: calc(100% + 1rem);
left: auto;
html.js main#content.notes-active .post-note.placed[data-side="left"] {
border-right-width: 2px;
text-align: left;
}
}