Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using twitter bootstrap, how to make an embedded video responsive?

I am trying to make an embedded video responsive to window size change and compatible with mobile screens as well. Does anyone know which class to implement or how to make the video responsive? Thanks.

like image 911
creedjarrett Avatar asked Feb 14 '14 19:02

creedjarrett


4 Answers

The responsive embed component was added with the release of Bootstrap 3.2.0.

<!-- 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>
like image 109
Jeremy Cook Avatar answered Oct 14 '22 04:10

Jeremy Cook


The easiest way for HTML5 video is to add class="img img-responsive" to video tag:

<video controls class="img img-responsive">
like image 41
bartbar Avatar answered Oct 14 '22 03:10

bartbar


Check out the "Responsive video CSS" - Source Code on github.

Here's a working demo on Bootply. Click Run and see it resize for different screen sizes.

<section class="row">
  <div class="span6">
    <div class="flex-video widescreen"><iframe src="https://www.linktoyourvideo.com/..." frameborder="0" allowfullscreen=""></iframe></div>
  </div>
  <div class="span6">
    ...
  </div>
</section>
like image 37
Shiva Avatar answered Oct 14 '22 02:10

Shiva


Check out the responsive-embedd.css located archive. apply the class .embed-responsive to your embed container or any of the other classes you wish.

like image 1
brandrich Avatar answered Oct 14 '22 04:10

brandrich