Skip to content

Commit 8743a09

Browse files
committed
fix: text and TOC centering
1 parent b0cd1dd commit 8743a09

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

docs/theme/pagetoc.css

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
:root {
2-
--toc-width: 310px;
2+
--toc-width: 270px;
33
--center-content-toc-shift: calc(-1 * var(--toc-width) / 2);
4-
--center-content-shift: 0;
54
}
65

76
.nav-chapters {
@@ -17,26 +16,42 @@
1716
margin-left: var(--page-padding);
1817
}
1918

20-
@media only screen and (max-width: 1439px) {
21-
.sidetoc {
22-
display: none;
19+
@media only screen {
20+
main {
21+
display: flex;
2322
}
24-
}
2523

26-
@media only screen and (min-width: 1440px) {
27-
main {
28-
position: relative;
29-
/* center the text */
30-
/* left: var(--center-content-shift); */
24+
@media (max-width: 1179px) {
25+
.sidebar-hidden .sidetoc {
26+
display: none;
27+
}
28+
}
3129

32-
/* or, center both the text and the TOC */
33-
left: var(--center-content-toc-shift);
34-
display: flex;
30+
@media (max-width: 1439px) {
31+
.sidebar-visible .sidetoc {
32+
display: none;
33+
}
34+
}
35+
36+
@media (1180px <= width <= 1439px) {
37+
.sidebar-hidden main {
38+
position: relative;
39+
left: var(--center-content-toc-shift);
40+
}
3541
}
42+
43+
@media (1440px <= width <= 1700px) {
44+
.sidebar-visible main {
45+
position: relative;
46+
left: var(--center-content-toc-shift);
47+
}
48+
}
49+
3650
.content-wrap {
3751
overflow-y: auto;
3852
width: 100%;
3953
}
54+
4055
.sidetoc {
4156
margin-top: 20px;
4257
margin-left: 10px;

0 commit comments

Comments
 (0)