Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

materializecss - video in the background

I want the video to be played only in div "index -banner " , but it is being played in full page until you reach the footer . Already I tried everything without success.

Example: background

<!-- Video -->
  <div class="section no-pad-bot" id="index-banner">
    <div class="container">

      <div class="col s12 m4">
          <div class="icon-block">
            <h2 class="center light-blue-text"><i class="material-icons">group</i></h2>
            <h5 class="center">User Experience Focused</h5>

            <p class="light">Text</p>
          </div>
        </div>

        <video autoplay loop id="bgvid">
            <source src="video/fundo.webm" type="video/webm">
            <source src="video/fundo.mp4" type="video/mp4">
        </video>

    </div>
  </div>

Code CSS:

video#bgvid { 
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    -ms-transform: translateX(-50%) translateY(-50%);
    -moz-transform: translateX(-50%) translateY(-50%);
    -webkit-transform: translateX(-50%) translateY(-50%);
    transform: translateX(-50%) translateY(-50%);
}
like image 498
Paulo Roberto Avatar asked Dec 06 '25 07:12

Paulo Roberto


1 Answers

You have

min-width: 100%;
min-height: 100%;
width: auto;
height: auto;

Why not just set all of that to

width: 100%;
height: 100%;

?

like image 168
Caroline Hermans Avatar answered Dec 07 '25 20:12

Caroline Hermans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!