Skip to content

Commit 2516948

Browse files
committed
fix: youtube videos not responsive
1 parent 70e423e commit 2516948

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/app/_components/markdown-styles.module.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,22 @@
6969
font-family: monospace;
7070
font-size: 0.875rem;
7171
}
72+
73+
/* Responsive iframe styles for embedded videos */
74+
.markdown iframe {
75+
max-width: 100%;
76+
height: auto;
77+
aspect-ratio: 16 / 9;
78+
margin-top: 1.5rem;
79+
margin-bottom: 1.5rem;
80+
border-radius: 0.5rem;
81+
}
82+
83+
/* For mobile devices, ensure iframe doesn't overflow */
84+
@media (max-width: 640px) {
85+
.markdown iframe {
86+
width: 100%;
87+
height: auto;
88+
aspect-ratio: 16 / 9;
89+
}
90+
}

src/app/globals.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
a {
3232
@apply text-accent hover:text-accent-light transition-colors duration-200;
3333
}
34+
35+
/* Make all iframes responsive by default */
36+
iframe {
37+
max-width: 100%;
38+
height: auto;
39+
}
3440
}
3541

3642
@layer components {

src/app/newblog/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ export default function Contribute() {
141141
</code>
142142
</pre>
143143
<p className="mb-3">
144-
Replace <code className="bg-mono-100 px-2 py-1 rounded dark:bg-mono-800 dark:text-mono-200">VIDEO_ID</code> with the ID of your YouTube video (found in the YouTube URL after "v=").
144+
Replace <code className="bg-mono-100 px-2 py-1 rounded dark:bg-mono-800 dark:text-mono-200">VIDEO_ID</code> with the ID of your YouTube video (found in the YouTube URL after "v=").
145+
<strong className="text-green-600 dark:text-green-400"> Note: The video embeds are automatically responsive and will scale properly on mobile devices.</strong>
145146
</p>
146147
<h4 className="text-lg font-medium mb-2">2. Self-hosted Videos</h4>
147148
<p className="mb-3">

0 commit comments

Comments
 (0)