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

不言
Release: 2018-08-09 15:43:21
Original
3482 people have browsed it

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
Copy after login

object-fit value description

object-fit is mainly suitable for For replacing elements, such as:,,,,,, and, etc. Its default value isfill. 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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!