时间:2021-07-01 10:21:17 帮助过:36人阅读
给网站头部添加视频海报的代码:
<!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>
结果
以上就是如何在网站头部添加视频海报?添加视频海报的方法(代码示例)的详细内容,更多请关注Gxl网其它相关文章!