Skip to content

Commit 959f280

Browse files
Add new CSS styling for video
Testing a new CSS implementation for the video containers - Should auto-size to a maximum width (defaulted with 500px)
1 parent a9b0ae3 commit 959f280

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

docs/introduction.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ icon: material/book-open-page-variant
1818

1919
<center>
2020

21-
<article class="video-container">
21+
<article class="video-500px">
2222
<iframe src="https://www.youtube.com/embed/A9NTdowiY_o" title="Product Showcase Video" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
2323
![QR code to product video](./assets/img/qr_code/product_video.png){ .qr width=100 }
2424
</article>
@@ -352,7 +352,7 @@ To get started, users will need a few items. Some users may already have a few o
352352
<div style="max-height=400px;" markdown>
353353

354354
<center>
355-
<div class="video-container">
355+
<div class="video-500px">
356356
<iframe src="https://www.youtube.com/embed/x0RDEHqFIF8" title="SparkFun's Qwiic Connect System" frameborder="0" allow="accelerometer; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
357357

358358
![QR code to instructional video](./assets/img/qr_code/qwiic_video.png){ .qr width=100 }

docs/stylesheet/extra.css

+16
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,22 @@
366366
overflow: hidden;
367367
}
368368

369+
.video-500px {
370+
position: relative;
371+
padding-bottom: min(281.25px, 56.25%); /* 16:9 */
372+
height: 0;
373+
max-width: 500px;
374+
max-height: 281.25px;
375+
}
376+
.video-500px iframe {
377+
position: absolute;
378+
top: 0;
379+
left: 0;
380+
width: 100%;
381+
height: 100%;
382+
overflow: hidden;
383+
}
384+
369385
/* Add compatibility for mobile devices */
370386
/* ================================================================================== */
371387
/* ================================================================================== */

0 commit comments

Comments
 (0)