【问题标题】:How can I make a YouTube video in an iframe go full screen?如何在 iframe 中全屏制作 YouTube 视频?
【发布时间】:2018-12-19 05:08:20
【问题描述】:

当我在 iframe 中嵌入 YouTube 视频时,它工作正常,但在完整模式下,视频在整个屏幕上不可见

<iframe src="https://www.youtube-nocookie.com/embed/rGmF2CaDiBg?rel=0" 
        frameborder="0" allow="autoplay; encrypted-media" class="iframe" 
        id="Overlayvideo" **allowfullscreen="true"**>
</iframe>

【问题讨论】:

    标签: html iframe youtube youtube-iframe-api


    【解决方案1】:

    在您的 CSS 中使用以下内容 #Overlayvideo { width: 100%;}

    【讨论】:

      【解决方案2】:

      HTML

      <iframe src="https://www.youtube-nocookie.com/embed/rGmF2CaDiBg?rel=0" 
              frameborder="0" allow="autoplay; encrypted-media" class="iframe" 
              id="Overlayvideo" allowfullscreen>
      </iframe>
      

      CSS

      iframe {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      }
      

      【讨论】:

        猜你喜欢
        • 2013-02-13
        • 2018-02-15
        • 2016-06-13
        • 2016-02-14
        • 2018-04-12
        • 2021-08-21
        • 2016-08-25
        • 1970-01-01
        相关资源
        最近更新 更多