简体   繁体   English

限制html5视频的最小尺寸

[英]Limit the minimum size of html5 video

I have the following html on a html5 video: 我在html5视频上有以下html:

<video id="video1" autoplay>
       <source src="static/video/5986637.mp4" type="video/mp4"/>
       Your browser does not support the video tag.
</video>

css: CSS:

video
{
width: 100%    !important;
height: auto   !important;
position:fixed;
}

I want to keep the width and height in such css until the height of the video is smaller than a certain value. 我想在这样的CSS中保持宽度和高度,直到视频的高度小于某个值。 After smaller than a certain value, the height will remain unchanged while the width will still keep 100%. 小于一定值后,高度将保持不变,而宽度仍将保持100%。 So what I should do in CSS/Javascript? 那我应该在CSS / Javascript中做什么呢? Thanks. 谢谢。

You can use CSS min-height for this. 您可以为此使用CSS最小高度。 For more info: https://developer.mozilla.org/en-US/docs/Web/CSS/min-height 有关更多信息: https : //developer.mozilla.org/en-US/docs/Web/CSS/min-height

video {
  min-height: 200px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM