css - 在视频周围环绕图像(响应式)

标签 css html twitter-bootstrap

我想将笔记本电脑图片包裹在 YouTube 视频周围。我已经找到了解决方案。现在我想让所有东西都能响应较小的设备。有什么解决方案吗?

body {
  padding-top: 70px;
  /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */
}
#tv_container {
  background: url('img/video.jpg') no-repeat top left transparent;
  width: 1440px; /* Adjust TV image width */
  height: 810px; /* Adjust TV image height */
  position: relative;
}
#tv_container iframe {
  position: absolute;

}
.videoWrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  padding-top: 25px;
  height: 0;
}
.videoWrapper iframe {
  position: relative;
  top: 78px;
  left: 252px;
  width: 65%;
  height: 67%;
}
<div class="container">
  <div id="tv_container">
    <div class="videoWrapper">
      <iframe width="760" height="315" src="https://www.youtube.com/embed/qidS1nnK0Ps" frameborder="0" allowfullscreen></iframe>
    </div>
  </div>
</div>

最佳答案

您应该更改 #tv_container 样式以使用可变宽度:

#tv_container {
    background: url('img/video.jpg') no-repeat top left transparent;
    width: 80%;
    height: auto;
    position: relative;
}

我还为容器使用了 auto 高度,因此它会根据宽度变化。

关于css - 在视频周围环绕图像(响应式),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42245150/

相关文章:

html - 在 html 中设置表格样式

javascript - 尝试从一个站点加载 div 并使用 jQuery 将其显示在另一个站点上,但没有显示任何内容

html - 使用图像 Bootstrap 将轮播标题居中并调整大小

twitter-bootstrap - 获取 Font Awesome 图标列表

css - 如何使输入组填充水平空间?

css - 选择语句宽度大小无法正常工作?

javascript - 如何根据可见高度显示元素溢出计数?

html - 如何设置输入文本的背景颜色?

html - 调整窗口大小时如何动态更改截面高度?

html - 第一次使用图像贴图