Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74297

Make background video more responsive with Bootstrap

$
0
0

I found this example for background video on this link: https://bootstrapious.com/p/fullscreen-video-background and everything works very well, except on the mobile. Video is somehow cut from both sides, text on video is ok but video isn't.

Here is code:

<div class="video-background-holder">
  <div class="video-background-overlay"></div>
  <video playsinline="playsinline" autoplay="autoplay" muted="muted" loop="loop">
        <source src="http://www.html5rocks.com/en/tutorials/video/basics/Chrome_ImF.mp4" type="video/mp4">
    </video>
  <div class="video-background-content container h-100">
    <div class="d-flex h-100 text-center align-items-center">
      <div class="w-100 text-white">
        <h1 class="display-4">Bootstrap video background</h1>
        <p class="lead mb-0">With HTML5 Video and Bootstrap 4</p>
        <p class="lead">Snippet by <a href="https://bootstrapious.com/snippets" class="text-white">
                    <u>Bootstrapious</u></a>
        </p>
      </div>
    </div>
  </div>
</div>

CSS

.video-background-holder {
  position: relative;
  background-color: black;
  height: calc(100vh - 72px);
  min-height: 25rem;
  width: 100%;
  overflow: hidden;
}

.video-background-holder video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  z-index: 0;
  -ms-transform: translateX(-50%) translateY(-50%);
  -moz-transform: translateX(-50%) translateY(-50%);
  -webkit-transform: translateX(-50%) translateY(-50%);
  transform: translateX(-50%) translateY(-50%);
}

.video-background-content {
  position: relative;
  z-index: 2;
}

.video-background-overlay {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: black;
  opacity: 0.5;
  z-index: 1;
}

Also here is full url of my fiddle: https://jsfiddle.net/6fr90ymv/2/ Basically this is what I want to achieve on mobile,enter image description here

Can somebody help me with this?


Viewing all articles
Browse latest Browse all 74297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>