Html5 video background, keep center of video in center

后端 未结 10 1360
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 12:00

I am trying to keep a background video centered regardless of how big the user drags the video. It\'s currently cutting off the right side of the videos when i scroll smalle

10条回答
  •  生来不讨喜
    2020-12-23 12:14

    here's how I typically do background video, and how I did it for the stre.am landing page:

    .video_contain {
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
    }
    
    video {
        position: absolute;
        top: 0;
        bottom: 0;
        right: 0;
        left: 0;
        margin: auto;
        min-height: 50%;
        min-width: 50%;
    }
    

    stream fs vid for mobile

提交回复
热议问题