我如何拉伸嵌入式视频,以强制地进行整个浏览器宽度>
我已经尝试在其上使用宽度和高度100%,但是出现的问题是,框架本身具有整体宽度和高度,但是视频保持其长宽比,周围有较大的灰色框架。使用Vimeo和YouTube的嵌入效果很好,但是当我使用基于自定义的CDN视频时,就会出现此问题 - 这是我所需要的。
I already tried using width and height 100% on it, but the issue that arises is that the frame itself takes the whole width and height, but the video keeps its aspect ratio, with a large grey frame around it. Using embeds from Vimeo and Youtube works well, but this issue arises when I use a custom CDN-based video - which is what I need.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过在iframe上进行
最小宽度:100%
?如果页面不是全尺寸,那么它可能会占用其宽度。因此,您也可以尝试:身体{高度:100VH; }
Have you tried doing
min-width: 100%
on the iframe? If the page is not full size, then it might be taking up the width of that. So you could also try:body { height: 100vh; }
我的第一个猜测是只制作CSS规则,选择iframe内部的元素。但是TT似乎是您必须使用JavaScript进行操作,并更改IFRAME中加载页面的CSS。 CSS很少能自行执行此操作。
有关更多信息,请参见:
如何将CSS应用于iframe?
My first guess was to just make a CSS rule selecting the element inside the iFrame. But tt seems as you have to do it with Javascript and change the CSS of the loaded page in the iFrame. CSS is rarely able to do this on its own.
For more information see:
How to apply CSS to iframe?