3

I am using Bootstraps grid system to create a responsive site that displays content in containers, never exceeding the viewing height, and display width using three columns, unless viewed through a small screen, in which case then 1 column. Problem is, my youtube embed is not responsive. I've tried setting it to 100%, auto, using several bootstrap classes, switching from embed to iframe and trying many of the same ideas. Nothing is working. I end up with a small static height of about 100px, no matter the width. Here is my html.

<div class="row">
  <div class="col-md-4"><center>
    <h1>Once in a lifetime</h1>
    <p>
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksg
    </p>
  </center></div>
  <div class="col-md-4"><center>

<embed width="80%" height="100%" src="//www.youtube.com/embed/NOcjwN3jkZ4?autoplay=1" frameborder="0" allowfullscreen></embed>

</center></div>
  <div class="col-md-4"><center>
    <h1>Check it out!</h1>
    <a href="http://wwww.link.xyz"><h3>http://wwww.link.xyz</h3></a>
  </center></div>
</div>

and here is some css I'm using to prevent horizontal scroll.

html, body {
  max-width: 100%;
  height:100%;
  overflow-x: hidden;
}

Please help.

daniula
  • 6,898
  • 4
  • 32
  • 49
Goose
  • 4,764
  • 5
  • 45
  • 84

1 Answers1

4

Using any of the snippets below will allow browsers to determine video 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="//www.youtube.com/embed/NOcjwN3jkZ4?autoplay=1"></iframe>
</div>

<!-- 4:3 aspect ratio -->
<div class="embed-responsive embed-responsive-4by3">
  <iframe class="embed-responsive-item" src="//www.youtube.com/embed/NOcjwN3jkZ4?autoplay=1"></iframe>
</div>

You may want to checkout bootstrap documentation for more info on this

http://getbootstrap.com/components/

Chuks
  • 1,134
  • 11
  • 21