HTML 5视频拉伸 [英] HTML 5 Video stretch

查看:304
本文介绍了HTML 5视频拉伸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你可以制作视频拉伸到宽度&视频元素的高度?显然,默认情况下,视频得到缩放&按比例安装在视频元素内。

Can you make a video "stretch" to the width & height of the video element? Apparentlyby default, video gets scaled & fitted inside the video element, proportionally.

谢谢

推荐答案

我已经通过使用object-fit进行了测试:填写CSS

I have tested by using object-fit: fill in CSS

工程良好。

video {
  object-fit: fill;
}

来自MDN( https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit ):

对象适合的CSS属性指定替换元素的内容应如何适应由其使用的高度和宽度确定的框。

The object-fit CSS property specifies how the contents of a replaced element should be fitted to the box established by its used height and width.

值:fill

替换的内容大小适合填充元素的内容框:对象的具体对象大小是元素的使用宽度和高度。

The replaced content is sized to fill the element’s content box: the object’s concrete object size is the element’s used width and height.

这篇关于HTML 5视频拉伸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆