【发布时间】:2018-06-04 01:03:27
【问题描述】:
我是 HTML 和 CSS 编码的新手,现在遇到了挑战。 我目前正在寻找如何将 iFrame 视频置于页面中心的解决方案。
HTML
<section id="video">
<div class="row">
<div class="video-container">
<iframe width="853" height="480" src="https://www.youtube.com/embed/rXuWb0RXfEI" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</section>
CSS:
.video-container {
position:relative;
padding-bottom:56.25%;
padding-top:30px;
margin-top: 100px;
height:0;
overflow:hidden;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
width:80%;
height:80%;
}
.row {
text-align: center;
}
希望有人能帮我解决这个问题...
【问题讨论】:
-
这可能会有所帮助; stackoverflow.com/questions/8366957/…