Create responsive video or slideshow embeds based on the width of the parent by creating an intrinsic ratio that scales on any device.
It can be applied to <iframe>
, <embed>
, <video>
, and <object>
elements. When you want to match the styling for other attributes use an descendant class .embed-responsive-item
.
You don't need to include frameborder="0"
in your <iframe>
.
In a parent element wrap any embed like an <iframe>
with .embed-responsive
and an aspect ratio. You must add .embed-responsive-item
to iframe.
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item" src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" allowfullscreen></iframe>
</div>
Aspect ratios can be customized with modifier classes .embed-responsive-21by9, .embed-responsive-16by9, .embed-responsive-4by3 and .embed-responsive-1by1.
<!-- 21:9 aspect ratio -->
<div class="embed-responsive embed-responsive-21by9">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>
<!-- 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>
<!-- 1:1 aspect ratio -->
<div class="embed-responsive embed-responsive-1by1">
<iframe class="embed-responsive-item" src="..."></iframe>
</div>