我遇到了 tumblr cutom 主题创建者的问题。例如,在添加视频帖子时,他们将其放入具有设定宽度和高度的 iframe 中。我可以重置 iframe 的宽度,视频会相应地拉伸,但高度保持不变(如预期的那样)。
但是当我将高度设置为自动时,它会挤压成一个小矩形,而不是假设其正常的宽高比(正如我所想的那样)。有没有办法让 iframe 在 iframe 中保持为它设置的比率,但使用 CSS 放大/缩小它?JQuery 也可以,但首选 CSS。
HTML
<div class="video">
{VideoEmbed} // tumblr replaces this with an iframe containing the video
</div>
CSS(不工作)
.video iframe {
height: auto // not working (as in, not producing desired effect)
width: 700px // working
}