html5标签高度,HTML5视频标签的宽度和高度

All, I have some video playing on my website, and I want it to play width: 100%; height: 600px; but nothing I have tried has worked so far.

我在我的网站上放了一些视频,我希望它的宽度是100%;身高:600 px;但到目前为止,我还没有尝试过什么。

When I set the height: 600px; the width of the video is proportionate. I basically want to achieve the same effect as background-size: cover, with a height of 600px. I am using inline CSS, and that part can be changed, but I am more concerned with how to achieve a custom height and width of a video, if even possible. Thank you.

设置高度:600px;视频的宽度是成比例的。我基本上想要达到和背景一样的效果:覆盖,高度600像素。我正在使用内联CSS,这部分可以修改,但我更关心如何实现视频的自定义高度和宽度,如果可能的话。谢谢你!

ANY help is highly appreciated. Here is my code for the

非常感谢您的帮助。这是我的

的代码

1 个解决方案

#1

8

One way to accomplish this is to wrap the video in a div and give that the height of 600px and overflow: hidden.

实现这一点的一种方法是将视频封装在一个div中,并给出600px和溢出的高度:隐藏。

For example:

例如:

Note that the video may be cut off towards the bottom if its proportionate height is greater than 600px and that the more you stretch the window, the more the video will be cut off.

请注意,如果视频的比例高度大于600px,那么视频可能会被切向底部,而且你拉伸窗口的时间越长,视频就越会被切掉。

Here is a jsFiddle using this code:

下面是一个使用此代码的jsFiddle:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值