【问题标题】:How would I embed a responsive playable youtube video inside this image?如何在此图像中嵌入响应式可播放 youtube 视频?
【发布时间】:2019-04-24 16:49:24
【问题描述】:

如何将响应式可播放 youtube 视频嵌入到这台电视中? (最好不要自动播放)。

我遇到了困难,想知道是否有人可以提供帮助。谢谢。

.tv {
  position: absolute;
  left: calc(50% - 550px/2);
  top: calc(50% - 380px/2);
}

.tv img {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  width: 550px;
}

.video {
  position: absolute;
  top: 25px;
  left: 20px;
}



.b {
  width: 400px;
  height: 300px;
  background: black;
}
<div class="tv">
  <img src="http://honeypotmarketing.com/wp-content/uploads/OLD-SCHOOL-TV.png" alt="" />
  <!-- broken video -->
  <div class="video">
        <video class="b" src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" autoplay></video>
  </div>
</div>

【问题讨论】:

    标签: html css video embed


    【解决方案1】:

    为了响应,您需要为 div heigh:auto 和 width 添加 css,而不是像素,例如:

    style="max-width:100%;height:auto;"
    

    希望它有效。 谢谢:)

    【讨论】:

      猜你喜欢
      • 2021-01-19
      • 1970-01-01
      • 2012-09-24
      • 2010-10-15
      • 1970-01-01
      • 2018-12-16
      • 1970-01-01
      • 2015-11-01
      • 1970-01-01
      相关资源
      最近更新 更多