html - 纵向模式下的响应式 iframe 视频
问题描述
我有一个带有垂直视频(9:16)的 iframe,包裹在一个覆盖整个剩余屏幕高度的 div 周围。我正在尝试使 iframe 覆盖包装器的整个高度并仍然保持纵横比。互联网上到处都是水平视频的解决方案,但我似乎无法让它工作......
下面的代码可以工作,但感觉不太稳定。它假设宽度是高度减去固定标题高度的 56.25% (9/16)。同样,它可以工作,但有点跳动,并且在添加边距/填充时会中断。
<header>... header stuff ...</header>
<div class="iframe-wrapper">
<iframe src="..vertical_video..">
</div>
* {margin:0;padding:0}
header {height: 60px;width: 100%;background-color: red;}
.iframe-wrapper {height: calc(100vh - 60px);width: 100%;display: flex;justify-content: center;background-color: blue;}
iframe {height: 100%;width: calc((100vh - 60px)*9/16);border:none;}
解决方案
推荐阅读
- c++ - 调整四叉树的大小
- r - 如何在不合并 r 中的数据框的情况下从多个数据框的列名中删除“-”和空格
- flutter - 学习颤振
- android - Android Studio Kotlin:尝试从 inputStream(蓝牙)读取时应用程序冻结
- java - 使用 Hibernate 从 MS SQL 检索值而不执行创建 CRUD 操作
- python - subprocess.Popen和线程的python3有线行为
- r - 复制具有不同大小案例的函数
- android - 如何在 Flutter 中使用填充“ISO10126”进行 AES 加密?
- javascript - 我在 sequelize.js 中存在一对多关联的左外连接问题
- reactjs - React 中重复表单的表单数据绑定