Home  >  Article  >  Web Front-end  >  Usage of video tag in Html5: How to automatically fill the parent div tag

Usage of video tag in Html5: How to automatically fill the parent div tag

不言
不言Original
2018-08-09 15:43:213553browse

This article introduces to you the usage of the video tag in Html5: how to automatically fill in the parent div tag. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

If you want the video to automatically fill the size of the slow parent div, just add style="width= 100%; height=100%; object-fit: fill" to the video tag.

object-fit syntax

The syntax of the object-fit attribute is very simple:

object-fit:fill | contain | cover | none | scale-down

object-fit value description

object-fit is mainly suitable for For replacing elements, such as: 39000f942b2545a5315c57fa3276f220, 273238ce9338fbb04bee6997e5552b95, a1f02c36ba31691bcfe87b2722de723b, 1c2b27461b5de677f7b3b8570650ea4c, 486d7a50595533609bc98d44595dc670, 7e441d6a19e1baa5cd948308fc07d711, and 49ee62822bf0c6386fbdcf36ecd91df0, etc. Its default value is fill. The description of the object-fill value is as follows:

fill: This value is the default value of boject-fit. The size of the replacement content is set to fill the content box of the element, that is, the content of the element is expanded to completely Fills the container's outer dimensions, even if this breaks its intrinsic aspect ratio.

contain: Replace the element content size to maintain the aspect ratio to fill the element content container, and its specific object size is parsed as the width and height of a containing element. That is, if you set an explicit height and width on the replacement element, this value will cause the content to be sized exactly at the fixed ratio, but still within the element dimensions.

cover: Replace the element content size to maintain the aspect ratio to fill the element content container, and its specific object size is parsed to cover the width and height of the entire element. That is, the replacement element content size maintains the aspect ratio, but changes the width and height so that it completely covers the content element.

none: The content of the replaced element does not resize to fit the container of the inner element. The content completely ignores any height and weight set on the element and still displays within the element's dimensions.

Scale-down: When the content size is set to non or contain, it will cause the specific object to become smaller.

Related recommendations:

Example codes for div tags in HTML5

##What are the tags and common rules in HTML5? Introduction to html5 tags and rules

The above is the detailed content of Usage of video tag in Html5: How to automatically fill the parent div tag. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn