css实现文字遮罩视频背景效果代码

代码语言:html

所属分类:其他

代码描述:css实现文字遮罩视频背景效果代码

代码标签: css 文字 遮罩 视频 背景

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">


    <meta name="viewport" content="width=device-width, initial-scale=1">



    <style>
        * {
        	box-sizing: border-box;
        }
        
        body {
        	font-family: Arial, sans-serif;
            height: 100vh;
        	overflow: hidden;
        }
        
        /* Video */
        
        .video-background {
          background: url(//repo.bfw.wiki/bfwrepo/image/5d6539613d08b.png) no-repeat center;
          background-size: cover;
          position: fixed;
          top: 0;
          right: 0;
          bottom: 0;
          left: 0;
          z-index: -1;
        }
        .video-foreground,
        .video-background iframe {
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          pointer-events: none;
        }
        
        @media (min-aspect-ratio: 16/9) {
          .video-foreground {
        	  height: 300%;
        	  top: -100%;
          }
        }
        
        @media (max-aspect-ratio: 16/9) {
          .video-foreground {
        	  width: 300%;
        	  left: -100%;
          }
        }
        
        /* Knockout Text */
        
        .knockout-text {
        	position: absolute;
        	top: 0;
        	display: flex;
        	justify-content: center;
        	align-items: center;
        	width: 100%;
        	height: 100%;
            font-size: calc(10px + 13vw + 2.5vh);
        	font-weight: 900;
        	letter-spacing: 0.15em;
            margin: auto;
        	text-transform: uppercase;
        	user-select: none;
            -webkit-text-stroke-color: #9f9f9f;
        	-webkit-text-stroke-width: 0.015em;	
        }
        
        .light-theme .knockout-text {
        	background-color: #fff;
            color: #000;
            mix-blend-mode: screen;
        }
        
        .dark-theme .knockout-text {
        	background-color: #000;
            color: #fff;
            mix-blend-mode: multiply;
        }
        
        /* Change Theme Button */
        
        .theme-btn {
        	position: absolute;
        	top: 1em;
        	left: 1em;
        	font-family: inherit;
        	font-size: calc(15px + 0.1vw + 0.5vh);
        	border-wid.........完整代码请登录后点击上方下载按钮下载查看

网友评论0