Skip to content

Commit bd03d85

Browse files
fix: enforce strict max-width 100% and overflow containment across all blog images
1 parent a3ee886 commit bd03d85

1 file changed

Lines changed: 31 additions & 5 deletions

File tree

src/pages/blog/[...slug].astro

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,10 @@ const title = post.data.title || post.id.split('/').pop()?.replace(/\.(md|markdo
6969

7070
.post-body {
7171
line-height: 1.8;
72-
color: #e2e8f0;
72+
color: var(--text-main);
7373
font-size: 1.05rem;
74+
overflow-x: hidden;
75+
word-break: break-word;
7476
}
7577

7678
/* Styling for Markdown content rendered inside post-body */
@@ -95,16 +97,16 @@ const title = post.data.title || post.id.split('/').pop()?.replace(/\.(md|markdo
9597

9698
.post-body :global(code) {
9799
font-family: var(--font-mono);
98-
background: rgba(15, 23, 42, 0.8);
100+
background: rgba(255, 255, 255, 0.06);
99101
padding: 0.2rem 0.4rem;
100102
border-radius: 6px;
101103
font-size: 0.9em;
102-
color: var(--accent-cyan);
103-
border: 1px solid rgba(255, 255, 255, 0.05);
104+
color: var(--text-main);
105+
border: 1px solid var(--border-glass);
104106
}
105107

106108
.post-body :global(pre) {
107-
background: #0f172a !important;
109+
background: var(--bg-surface) !important;
108110
padding: 1.25rem;
109111
border-radius: 12px;
110112
overflow-x: auto;
@@ -119,6 +121,30 @@ const title = post.data.title || post.id.split('/').pop()?.replace(/\.(md|markdo
119121
border: none;
120122
}
121123

124+
.post-body :global(img),
125+
.post-body :global(picture),
126+
.post-body :global(svg) {
127+
max-width: 100% !important;
128+
height: auto !important;
129+
display: block;
130+
margin: 1.5rem auto;
131+
border-radius: 8px;
132+
border: 1px solid var(--border-glass);
133+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
134+
}
135+
136+
.post-body :global(figure) {
137+
max-width: 100% !important;
138+
margin: 1.5rem 0;
139+
overflow-x: auto;
140+
}
141+
142+
.post-body :global(iframe),
143+
.post-body :global(video) {
144+
max-width: 100% !important;
145+
border-radius: 8px;
146+
}
147+
122148
.post-body :global(ul), .post-body :global(ol) {
123149
margin-left: 1.5rem;
124150
margin-bottom: 1.25rem;

0 commit comments

Comments
 (0)