V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
fl2d
V2EX  ›  问与答

嵌入网页的 youtube 视频不 responsive,有啥简单办法解决吗?

  •  
  •   fl2d · Oct 30, 2022 · 1006 views
    This topic created in 1283 days ago, the information mentioned may be changed or developed.

    比如下面这样的(直接从 youtube 里复制出来的)嵌入网页的 youtube 视频,

    复制进 html 文件,不能 responsive , 如何解决呢?

    <iframe width="560" height="315" src="https://www.youtube.com/embed/fozvwUkVLQ8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
    

    我不会 css ,网上搜到一些改 css 的,但我不知道在哪个 css 文件改啊。。

    有啥能就在 html 里能解决的方法么?

    2 replies    2022-10-31 08:07:24 +08:00
    dengqing
        1
    dengqing  
       Oct 30, 2022 via iPhone
    width height 都设置 100%
    fl2d
        2
    fl2d  
    OP
       Oct 31, 2022
    @dengqing
    100%不就窗口那么宽了嘛,还是想设置宽度啊。。窗口宽度小于视频宽度的时候 responsive 。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2829 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 13:49 · PVG 21:49 · LAX 06:49 · JFK 09:49
    ♥ Do have faith in what you're doing.