【问题标题】:Embed responsive vimeo video嵌入响应式 vimeo 视频
【发布时间】:2017-07-11 06:30:17
【问题描述】:

使用https://codepen.io/malditojavi/pen/BZGVoq - 我正在尝试摆脱由 Bootstrap 中的 responsive 辅助类创建的 padding-bottom 额外空间。

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" rel="stylesheet">
<div class="container">
  <div class="row">
    <div class="col-md-6 embed-responsive embed-responsive-16by9">
      <iframe class="embed-responsive-item" style="height: 50%;" src="https://player.vimeo.com/video/195372563" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
    </div>
    <div class="col-md-6">
      <h2>Title</h2>
      <p>And some text</p>
    </div>
  </div>
  <div class="row">
    <div class="col-md-6 embed-responsive embed-responsive-16by9">
      <iframe class="embed-responsive-item" style="height: 50%;" src="https://player.vimeo.com/video/195372563" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
    </div>
    <div class="col-md-6">
      <h2>Title</h2>
      <p>And some text</p>
    </div>
  </div>
</div>

请注意,我在 iframe 行 style="height: 50%;" 中添加了一些额外的样式代码这样我就可以摆脱 Vimeo 创建的额外黑色空间。

【问题讨论】:

  • 您在codepen bootstrap -3中使用,并且您正在使用bootstrap -4的参考类。

标签: css twitter-bootstrap vimeo-player


【解决方案1】:

尝试此链接以响应式嵌入视频

embed responsively

试试这个

HTML

<div class="container">
  <div class="row videorow">
    <div class="col-md-6">
      <div class='embed-container'><iframe src='http://player.vimeo.com/video/195372563' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    </div>
    <div class="col-md-6">
      <h2>Title</h2>
      <p>And some text</p>
    </div>
  </div>

   <div class="row videorow">
    <div class="col-md-6">
      <div class='embed-container'><iframe src='http://player.vimeo.com/video/195372563' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    </div>
    <div class="col-md-6">
      <h2>Title</h2>
      <p>And some text</p>
    </div>
  </div>
</div>

CSS

.embed-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}
.embed-container iframe,
.embed-container object,
.embed-container embed { 
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.videorow{
  margin:10px auto;
}

Link for reference 希望这会有所帮助...

【讨论】:

  • 这很好用。谢谢@ChandraShekar。你拯救了我的一天。
猜你喜欢
  • 2018-09-20
  • 1970-01-01
  • 2021-10-07
  • 1970-01-01
  • 2013-07-23
  • 1970-01-01
  • 2015-02-16
  • 2017-01-03
  • 2016-06-04
相关资源
最近更新 更多