Use a video instead of a background image to create a cool web page. The background image is cool.

Source: Internet
Author: User

Use a video instead of a background image to create a cool web page. The background image is cool.

CSS code (css3 required)

Video {position: absolute; left: 50%; top: 50%; bottom: auto; right: auto; min-height: 100%; min-width: 100%;-webkit-transform: translateX (-50%) translateY (-50%);-moz-transform: translateX (-50%) translateY (-50%);-ms-transform: translateX (-50%) translateY (-50%);-o-transform: translateX (-50%) translateY (-50%); transform: translateX (-50%) translateY (-50% );
Z-index:-1 ;}

HTML code (Html5 required)

1 <body> 2 <div> 3 <video autoplay loop poster = "polina.jpg"> 4 <source src = "video.mp4" type = "video/mp4"> 5 6 </video> 7 </div> 8 <div> 9 <div> Hello world </div> 10 </body>

 

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.