Home > Web Front-end > H5 Tutorial > How to add a video poster to the header of the website? How to add a video poster (code example)

How to add a video poster to the header of the website? How to add a video poster (code example)

青灯夜游
Release: 2018-10-25 15:50:17
forward
3977 people have browsed it

The content of this article is to introduce how to add a video poster to the header of the website? How to add a video poster (code example). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Code to add a video poster to the website header:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>视频海报</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
    #banner{
        width: 100%;
        height: 500px;
        background: purple;
        overflow: hidden;
        position: relative;
    }
    #banner video{
        width: 100%;
        position: relative;
        opacity: 0.6;  /* 设置透明度 */
    }

    #banner h2,h4{
        position: absolute;
        top: 120px;
        left: 150px;
        width: 100%;
        text-align: left;
        color: #fff;
        line-height: 30px;
        
    }
    #banner h2{
        top: 80px;
        font-size: 40px;
        text-decoration: underline;
    }
    </style>
</head>
<body>
    <div id="banner">
        <video loop autoplay>   <!-- loop循环播放,autoplay自动播放 --> 
            <source src="video/banner.mp4">
        </video>
        <h2>SLOW DOWN</h2>
        <h4>静下来<br> 携一缕清风,续一杯清茶 <br> 且听风轻云淡</h4>
    </div>        
</body>
</html>
Copy after login

Result

The above is the detailed content of How to add a video poster to the header of the website? How to add a video poster (code example). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template