PHP前端开发

如何在网站头部添加视频海报?

百变鹏仔 2小时前 #H5教程
文章标签 头部

本篇文章给大家带来的内容是介绍如何在网站头部添加视频海报?添加视频海报的方法(代码示例) 。有一定的参考价值,有需要的朋友可以参考一下,希望对你们有所帮助。

给网站头部添加视频海报的代码:

<!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>

结果