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

查看:16
本文介绍了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:fill in 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):

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.

值:填充

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

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天全站免登陆