Skip to content

Instantly share code, notes, and snippets.

View alyssachk's full-sized avatar

Alyssa C. alyssachk

View GitHub Profile
@alyssachk
alyssachk / embed-responsive-video.css
Created September 24, 2016 16:00
CSS for embed video responsively.
.video-container {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
overflow: hidden;
}
.video-container iframe,
.video-container object,
@alyssachk
alyssachk / embed-responsive-video.html
Last active September 24, 2016 16:36
Embed responsive video in HTML.
<!--Embed YouTube Video-->
<div class="video-container">
<iframe src="http://www.youtube.com/embed/D6Ac5JpCHmI" width="560" height="315" allowfullscreen></iframe>
</div>
<!--Embed Vimeo Video-->
<div class="video-container">
<iframe src="https://player.vimeo.com/video/158050352" width="560" height="315" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
@alyssachk
alyssachk / inline-embed-responsive-video.html
Last active September 24, 2016 16:52
Embed responsive video by editing HTML file only.
<p style="position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0;">
<iframe style="position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; border: 0 none;"
src="http://www.youtube.com/embed/D6Ac5JpCHmI" allowfullscreen></iframe></p>
@alyssachk
alyssachk / responsive-embed-bootstrap.html
Created September 24, 2016 17:02
Allow browsers to determine video or slideshow dimensions based on the width of their containing block by creating an intrinsic ratio that will properly scale on any device.
<!-- 16:9 aspect ratio -->
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>