Skip to content

Commit ac2c7b7

Browse files
committed
style: fix layout structure for proper sticky header and footer
- Fix flexbox layout to use min-height: 100vh instead of height - Make sidebar sticky positioned - Ensure header and footer are fixed while content scrolls - Simplify content area without forced height constraints
1 parent f537325 commit ac2c7b7

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

assets/css/style.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ body {
1313
line-height: 1.6;
1414
color: #24292e;
1515
background-color: #f6f8fa;
16+
min-height: 100vh;
1617
display: flex;
1718
flex-direction: column;
1819
}
1920

2021
.wrapper {
2122
max-width: 1200px;
23+
width: 100%;
2224
margin: 0 auto;
2325
padding: 0 16px;
2426
flex: 1;
@@ -30,6 +32,7 @@ body {
3032
background-color: #24292e;
3133
color: #fff;
3234
padding: 16px 0;
35+
flex-shrink: 0;
3336
}
3437

3538
.site-title {
@@ -59,22 +62,20 @@ body {
5962
.page-content {
6063
padding: 32px 0;
6164
flex: 1;
62-
display: flex;
63-
flex-direction: column;
6465
}
6566

6667
.page-content .wrapper {
6768
display: flex;
6869
gap: 32px;
69-
flex: 1;
70-
min-height: 0;
70+
height: 100%;
7171
}
7272

7373
.sidebar {
7474
width: 260px;
7575
flex-shrink: 0;
76-
overflow-y: auto;
77-
max-height: calc(100vh - 200px);
76+
align-self: flex-start;
77+
position: sticky;
78+
top: 0;
7879
}
7980

8081
.content {
@@ -84,8 +85,6 @@ body {
8485
padding: 24px;
8586
border-radius: 6px;
8687
box-shadow: 0 1px 3px rgba(0,0,0,0.12);
87-
overflow-y: auto;
88-
max-height: calc(100vh - 200px);
8988
}
9089

9190
.content h1 {
@@ -166,6 +165,7 @@ body {
166165
color: rgba(255,255,255,0.7);
167166
padding: 24px 0;
168167
text-align: center;
168+
flex-shrink: 0;
169169
}
170170

171171
.site-footer p {

0 commit comments

Comments
 (0)