【发布时间】:2019-12-13 06:30:15
【问题描述】:
当我嵌入 Vimeo iFrame 时,内容会自动居中。我想控制 iFrame 的对齐并将其保持在左侧。 (iFrame 很严重。)
我设置了一个 flexbox 容器 (.example-div),里面有两个 flex 容器。第一个容器 (.player-div) 中有股票 Vimeo iFrame 播放器。理想情况下,第二个容器将包含一个信用列表。我似乎无法证明左侧的 iframe 是合理的。
HTML
<div class="example-div">
<div class="player-div">
<iframe src="https://player.vimeo.com/video/142760309" frameborder="0" width="100%" allow="autoplay; fullscreen" allowfullscreen></iframe>
</div>
<div class="credits-div">
</div>
</div>
CSS
body {
margin: 0;
}
.example-div {
height: 100vh;
display: flex;
}
.player-div {
background-color: orange;
width: 80vw;
}
.credits-div {
background-color: green;
width: 20vw;
}
.player-div iframe, .player-div object, .player-div embed {
width: 100%;
height: 100%;
}
【问题讨论】:
-
为什么不简单地对齐 iframe 而不必担心它的内容?
-
理想情况下,这就是我想做的。问题是我希望 iframe 能够响应,所以我将其宽度设置为 100%。如果我不给它一个百分比宽度,它默认为一个非常小的尺寸。
标签: html css alignment vimeo vimeo-player