0
我成功地將youtube嵌入式視頻居中,但問題是,當我進入全屏模式時,視頻位置因爲transform:translate(-50%)
財產如何在全屏模式下保持嵌入式視頻爲中心
這裏是我的代碼:
<div class="videoWrapper">
<iframe class="trailervideo" width="560" height="315"
src="https://www.youtube.com/embed/TDwJDRbSYbw" frameborder="0"
allowfullscreen></iframe>
<div>
CSS:
.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
}
.videoWrapper iframe {
position: absolute;
max-width:560px;
max-height:315px;
width: 95%;
height: 95%;
left:50%;
transform:translate(-50%);
}