【发布时间】:2020-04-11 04:52:09
【问题描述】:
我知道这个问题已经被问过很多次,但我似乎无法解决我的问题。所以我在我的网站上添加了 youtube video iframe,当视频没有播放时,它会全屏显示。然后,当我单击播放时,它会在左右两侧添加间隙,并且视频没有以全尺寸播放。我从控制台检查并发现 video 标签正在引起问题。我尝试将 css 添加到 video 标签,但似乎它甚至没有显示在控制台中,所以它没有添加。
HTML:
<iframe height="450" src="https://www.youtube.com/embed/ftAQc3L1gR4?rel=0&autoplay=0&loop=0&modestbranding=0&showinfo=0&feature=0&controls=0&enablejsapi=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen" id="player_1" style="width: 100%;"></iframe>
CSS:
iframe video {
width: 100% inherit !important;;
height: inherit !important;
left: inherit !important;
top: inherit !important;
position: relative !important;
}
您可以在这里查看问题:https://raadev.wpengine.com
您可以转到第三张幻灯片,会出现一个 100% 宽度的 youtube iframe,但是当您点击播放时,它会在两侧显示间隙。
谁能帮我解决这个问题?
【问题讨论】:
-
能否提供您的示例的链接,您似乎想这样做,但最终没有连接任何链接。
-
@Buttered_Toast 抱歉,我忘记发布链接了。我编辑了我的问题。谢谢!
标签: javascript html css youtube