annofyf

先插入如下代码:

<video src="../video/2b.mp4" loop="loop" autoplay="autoplay"></video>

loop表示循环播放

autoplay表示自动播放

css修饰如下:

<style>
body{
    margin:0;//body外边距设为0;
}
video{
    position: fixed;//视频定位方式设为固定
    right: 0;
    bottom: 0;//视频位置
    min-width: 100%;
    min-height: 100%; //不会因视频尺寸造成页面需要滚动
    width: auto;
    height: auto; //尺寸保持原视频大小
    z-index: -100; //z轴定位,小于0即可
    -webkit-filter: grayscale(20%);//添加灰度蒙版,如果设定为100%则视频显示为黑白
}
</style>

这种方式也可以用于将图片设定为页面背景

分类:

技术点:

相关文章:

  • 2021-11-04
  • 2022-02-20
  • 2021-11-12
  • 2021-08-08
  • 2021-10-16
  • 2021-10-17
  • 2021-12-17
猜你喜欢
  • 2021-10-16
  • 2021-10-15
  • 2021-11-04
  • 2021-09-11
  • 2021-11-14
  • 2021-11-13
  • 2021-08-06
相关资源
相似解决方案