Observe below Image. HTML5 Video can be displayed through text, if text have 2 different stroke opacity and fill opacity properties. Normal HTML text won't provide stroke opacity and fill opacity features, Only SVG text does. So we have to implement this using SVG text.

SVG Text

<svg class="blur" xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" width="1050" height="498">
      <text x="30" y="350" fill="white" stroke="darkkhaki" stroke-width="3" fill-opacity="0" stroke-opacity="1">SVG</text>
</svg>
fill-opacity is 0 means filling area of text is completely transparent. stroke-opacity is 1 means stroke width of text is completely visible. Whatever displayed in the background, it will be visible to user through text

Markup

Observe below markup. Here I placed video as background to this demodiv
<div class="demoDiv">
    <svg class="blur" xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" width="1050" height="498">
      <text x="30" y="350" fill="white" stroke="darkkhaki" stroke-width="3" fill-opacity="0" stroke-opacity="1">SVG</text>
    </svg>
    <video id="work-letter-video-one" class="letter-video" autoplay="" preload="auto" loop="">
     <source src="letter-smoke.webm">
     <source src="letter-smoke.mp4">
   </video>
</div>

CSS

.demoDiv {
  position: relative;
  width: 883px;
  margin: auto;
}

.demoDiv text {
  font-size:400px;
}

.demoDiv video {
  width: 100%; 
  position: absolute;
  left:0px;
  top:0px;
  z-index:-1
}

1 comment:

Blogroll

Follow this blog by Email

Popular Posts