【发布时间】:2014-09-19 14:39:57
【问题描述】:
我正在为我的游戏着陆页制作移动版本。我有一个 youtube 预告片,它应该根据网站大小进行缩放,同时保持居中。但事实并非如此。您可以通过缩小浏览器大小在我的网站http://www.zatackaonline.net 上看到自己。
我尝试使用我在 StackOverflow 上的另一篇文章中找到的这段代码。这段代码将填满我不想要的整个屏幕。有什么方法可以将其缩小到 50%,同时保持嵌入的 iFrame 视频位置居中?
/*main.css*/
.video-container {
position: relative; /* keeps the aspect ratio */
padding-bottom: 56%; /* fine tunes the video positioning */
padding-top: 60px;
overflow: hidden;
}
.video-container iframe,
.video-container object,
.video-container embed { position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;
}
【问题讨论】:
标签: javascript html css youtube