How to use the video tag in HTML5: How to automatically fill in the parent div tag

Source: Internet
Author: User
This article introduces to you about the use of video tags in HTML5: How to automatically fill in the parent div tag, there is a certain reference value, the need for friends can refer to, I hope to help you.

Want video to automatically fill the size of the slow parent div, just add style= "width= 100% to the video tag; height=100%; Object-fit:fill "can.

Object-fit syntax

The syntax of the Object-fit property is very simple:

Object-fit:fill | Contain | Cover | none | Scale-down

Object-fit Value Description

Object-fit is mainly suitable for replacing elements such as:,,,, <video> <object> <input type="image"> <svg> , <svg:image> and <svg:video> etc. Its default value is fill . The Object-fill values are described as follows:

Fill: This value is the default value of Boject-fit, and the size of the replacement content is set to the content box of the fill element, that is, the content of the element expands to a fully populated container's form factor, even if it breaks its intrinsic aspect ratio.

Contain: The replacement element content size maintains a long-width proportional fill element content container whose specific object size is resolved to a containing element's width and height. That is, if you set an explicit height and width on the replacement element, this value causes the content size to be displayed completely at a fixed scale, but still within the element size.

Cover: The replacement element content size maintains a long-width proportional fill element content container whose specific object size is resolved 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 to completely overwrite the content element.

None: Replace the contents of the element without resizing to accommodate the inner element's container, which completely ignores any heights and weights set on the element, and is still displayed within the element dimensions.

Scale-down: When the content size is set to non or contain, the specific object becomes smaller.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.