Skip to content

Commit 6075210

Browse files
authored
Добавляет сайдбар с навигацией (htmlacademy#49)
* Добавляет сайдбар с навигацией * Возвращает исходные размеры текста. * Удаляет ненужные стили * Изменяет scroll-margin-top у заголовков * Изменяет адрес ссылки с котиком * Форматирует отступы для листингов кода * Форматирует отступы в листингах кода
1 parent 28c39ee commit 6075210

File tree

4 files changed

+840
-682
lines changed

4 files changed

+840
-682
lines changed

css/style.css

Lines changed: 152 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
*,
2+
*::before,
3+
*::after {
4+
box-sizing: border-box;
5+
}
6+
17
html {
28
font-size: 16px;
39
scroll-behavior: smooth;
@@ -14,12 +20,14 @@ body {
1420

1521
a:link,
1622
a:visited {
17-
color: #5a5a5a;
18-
text-decoration: underline;
23+
color: #3f3ccb;
24+
text-decoration: none;
1925
}
2026

21-
a:hover {
22-
text-decoration: none;
27+
a:hover,
28+
a:focus {
29+
color: #302683;
30+
text-decoration: underline;
2331
}
2432

2533
h1,
@@ -49,7 +57,7 @@ h2 {
4957

5058
h3 {
5159
font-size: 1.75rem;
52-
scroll-margin-top: 60px;
60+
scroll-margin-top: 20px;
5361
}
5462

5563
code,
@@ -155,12 +163,62 @@ header a:visited {
155163
height: 300px;
156164
}
157165

158-
.chapter h2 {
166+
.guide-content {
167+
display: flex;
168+
flex-wrap: wrap;
169+
}
170+
171+
.sidebar {
172+
display: flex;
173+
flex-direction: column;
174+
175+
width: 100%;
176+
}
177+
178+
.sidebar a {
179+
display: block;
180+
color: #5a5a5a;
181+
}
182+
183+
.sidebar a:hover {
184+
color: #3f3ccb;
185+
}
186+
187+
.sidebar-col {
159188
padding: 2rem 1rem;
189+
}
190+
191+
.sidebar-col + .sidebar-col {
192+
border-top: 1px solid #e5e5e5;
193+
}
194+
195+
.sidebar-col > a {
196+
font-size: 1.75rem;
197+
line-height: 1.25;
198+
}
160199

200+
.sidebar-menu {
201+
padding-left: 1rem;
202+
}
203+
204+
.chapters {
205+
width: 100%;
206+
}
207+
208+
.chapter h2 {
209+
padding: 2rem 1rem;
210+
word-break: break-word;
161211
background-color: #e5e5e5;
162212
}
163213

214+
.chapter h3[id]::before {
215+
display: block;
216+
height: 2rem;
217+
margin-top: -2rem;
218+
visibility: hidden;
219+
content: "";
220+
}
221+
164222
.chapter-part {
165223
display: flex;
166224
flex-direction: column;
@@ -275,6 +333,22 @@ footer {
275333
}
276334

277335
@media (min-width: 48em) {
336+
.sidebar {
337+
flex-direction: row;
338+
flex-wrap: wrap;
339+
340+
padding: 2rem 0;
341+
}
342+
343+
.sidebar-col {
344+
width: 50%;
345+
padding: 1rem 3rem;
346+
}
347+
348+
.sidebar-col + .sidebar-col {
349+
border-top: 0;
350+
}
351+
278352
.chapter h2 {
279353
padding: 2rem 3rem 2.5rem;
280354
}
@@ -285,7 +359,7 @@ footer {
285359

286360
.chapter-part-col {
287361
width: 50%;
288-
padding: 3rem;
362+
padding: 3rem 1.5rem;
289363
}
290364

291365
.chapter-part-col--full-width {
@@ -297,6 +371,77 @@ footer {
297371
}
298372
}
299373

374+
@media (min-width: 75em) {
375+
.chapters {
376+
width: calc(100% - 230px);
377+
}
378+
379+
.sidebar {
380+
position: sticky;
381+
top: 0;
382+
bottom: 0;
383+
384+
flex-direction: column;
385+
flex-wrap: nowrap;
386+
align-self: flex-start;
387+
388+
width: 230px;
389+
height: 100vh;
390+
padding: 0 1rem;
391+
392+
overflow-y: auto;
393+
line-height: 1.25;
394+
border-right: 1px solid #e5e5e5;
395+
}
396+
397+
.sidebar-col {
398+
flex-shrink: 0;
399+
400+
width: 100%;
401+
padding: 0;
402+
}
403+
404+
.sidebar-col-first {
405+
padding-top: 1.75rem;
406+
}
407+
408+
.sidebar-col-last {
409+
padding-bottom: 1.75rem;
410+
}
411+
412+
.sidebar-col + .sidebar-col {
413+
margin-top: 1.75em;
414+
}
415+
416+
.sidebar-col > a {
417+
display: block;
418+
419+
font-size: 0.8rem;
420+
font-weight: bold;
421+
}
422+
423+
.sidebar-menu {
424+
padding: 0;
425+
margin: 0.5em 0 0;
426+
427+
list-style: none;
428+
429+
font-size: 0.7rem;
430+
}
431+
432+
.sidebar-menu li {
433+
margin: 0;
434+
435+
line-height: 1.45;
436+
}
437+
438+
.sidebar-menu a {
439+
display: block;
440+
441+
padding: 0.25em 0;
442+
}
443+
}
444+
300445
/* override default prism theme */
301446
code[class*="language-"],
302447
pre[class*="language-"] {

0 commit comments

Comments
 (0)