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