为视频背景添加颜色叠加

met*_*lah 1 css

你怎么一个颜色叠加添加到这样的视频,看到这里

在此处输入图片说明

到目前为止,这是我的代码:

的HTML

<div>
  <div id="outer">
    <div id="home-top-video">
      <video autoplay loop muted width="100%">
        <source src="http://view.vzaar.com/2710053.mp4" type="video/mp4" /> Your browser does not support the video tag. We suggest you upgrade your browser.
      </video>
      <div id="home-text">
        <div><img src="http://marquesslondon.herokuapp.com/images/logo.ee1689ee.png"></div>
        <h3>LIFESTYLE</h3>
      </div>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

的CSS

#outer {
  width: 100%;
  display: block;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 100vh;
}

#home-top-video {
  left: 0%;
  top: 0%;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

#home-text {
  position: absolute;
  left: 50%;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}
Run Code Online (Sandbox Code Playgroud)

在这里提琴:https : //jsfiddle.net/kggv3213/1/

Zub*_*ber 7

保持简单,只需添加

#home-top-video:before {
    content: '';
    position: absolute;
    height: 100%;
    width: 100%;
    background: rgba(255,0,255,0.2); //Change as per your requirement
}
Run Code Online (Sandbox Code Playgroud)


Tem*_*fif 6

您可以尝试使用渐变背景的伪元素:

/* Latest compiled and minified CSS included as External Resource*/

/* Optional theme */
@import url('//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.min.css');

#outer {
  width: 100%;
  display: block;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 100vh;
}
#home-top-video:before {
  content:"";
  position: absolute;
  top:0;
  right:0;
  left:0;
  bottom:0;
  z-index:1;
  background:linear-gradient(to right,rgba(65, 0, 255, 0.4),rgba(255, 0, 232, 0.3));
}

#home-top-video {
  left: 0%;
  top: 0%;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

#home-text {
  position: absolute;
  left: 50%;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  color: #fff;
  z-index:1;
}
Run Code Online (Sandbox Code Playgroud)
<div>
  <div id="outer">
    <div id="home-top-video">
      <video autoplay loop muted width="100%">
        <source src="http://view.vzaar.com/2710053.mp4" type="video/mp4" /> Your browser does not support the video tag. We suggest you upgrade your browser.
      </video>
      <div id="home-text">
        <div><img src="http://marquesslondon.herokuapp.com/images/logo.ee1689ee.png"></div>
        <h3>LIFESTYLE</h3>
      </div>
    </div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)