CSS Video Text Masking: Creating Knockout Typography with background-clip & mix-blend-mode
To render live video inside typography, use mix-blend-mode: screen or an SVG <clipPath>. With mix-blend-mode: screen, place your <video> on the bottom layer, and overlay a container styled with background: #000; mix-blend-mode: screen; containing white text (color: #fff). Alternatively, define an inline <svg> with a <clipPath id="textClip"><text>YOUR TEXT</text></clipPath> and apply clip-path: url(#textClip) directly to an HTML5 <video> element for transparent cutouts.
NEBULA
Step 1: Approach 1: CSS mix-blend-mode: screen Overlay
The simplest pure CSS method uses mix-blend-mode: screen. Black pixels (#000000) become 100% transparent revealing the video beneath, while pure white (#ffffff) remains fully opaque.
<div class="video-mask-container">
<!-- Layer 0: Background Video -->
<video autoplay loop muted playsinline class="bg-video">
<source src="cosmic-flow.mp4" type="video/mp4">
</video>
<!-- Layer 1: Black Cutout Layer with White Text -->
<div class="knockout-screen-layer">
<h1 class="knockout-title">CINEMATIC</h1>
</div>
</div>
Step 2: Style the Blend Mode Stack in CSS
Set the knockout layer to black background and apply mix-blend-mode: screen. The parent container must establish a stacking context with position: relative and overflow: hidden.
.video-mask-container {
position: relative;
width: 100%;
height: 400px;
overflow: hidden;
background: #000;
}
.bg-video {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.knockout-screen-layer {
position: absolute;
inset: 0;
background: #000000; /* Pure black becomes invisible under screen blend */
mix-blend-mode: screen;
display: flex;
align-items: center;
justify-content: center;
}
.knockout-title {
color: #ffffff; /* Pure white lets video content shine through at 100% brightness */
font-size: clamp(4rem, 12vw, 9rem);
font-weight: 900;
letter-spacing: -0.04em;
margin: 0;
}
Step 3: Approach 2: SVG clipPath for Transparent Background Knockouts
When the background surrounding the text must be transparent or patterned rather than solid black, use an SVG clipPath. The clipPath crops the video geometry directly into glyph shapes.
<svg width="0" height="0" style="position: absolute;">
<defs>
<clipPath id="videoTextClip" clipPathUnits="objectBoundingBox">
<!-- Values normalized 0.0 to 1.0 for responsive scaling -->
<text
x="0.5"
y="0.65"
text-anchor="middle"
font-size="0.35"
font-family="Impact, sans-serif"
font-weight="900"
>
SPECTRUM
</text>
</clipPath>
</defs>
</svg>
<!-- Video clipped to text glyphs -->
<video
autoplay loop muted playsinline
style="width: 100%; height: 350px; object-fit: cover; clip-path: url(#videoTextClip);"
>
<source src="ink-fluid.mp4" type="video/mp4">
</video>
Step 4: Enhance with Dynamic Glow and Fallback Support
Add responsive fallbacks for browsers or devices with battery saving modes where video playback may pause. Utilize CSS filter: drop-shadow() on the parent to cast colorful glows.
.video-mask-container {
/* Dynamic drop shadow illuminated by video letterforms */
filter: drop-shadow(0 10px 25px rgba(56, 189, 248, 0.45));
}
/* Fallback for environments disabling background video */
@supports not (mix-blend-mode: screen) {
.knockout-title {
background: linear-gradient(135deg, #06b6d4, #ec4899);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
}
Next-Level Addons: Elevating Your Implementation
Take this technique further by combining it with complementary design token studios and animation tools:
A trick I use in almost every project: don't fight specificity battles with !important. Leverage modern CSS cascade layers (@layer) and CSS variables as design tokens—it makes dark/light theme switching and responsive tuning effortless.
Frequently Asked Questions
Practical answers to common implementation questions, browser quirks, and performance tips.
Why does mix-blend-mode: screen require a black background?
The screen blend mode computes output color using the formula: 1 - (1 - Target) * (1 - Blend). In mathematical terms, black RGB(0,0,0) equates to 0, producing zero modification to the underlying video pixel. White RGB(255,255,255) equals 1, resulting in full illumination.
Can I use -webkit-background-clip: text with an HTML5 video?
No. The background-clip property only operates on CSS background images, gradients, or colors—not <video> DOM elements. To mask real video with text, you must use mix-blend-mode: screen, SVG <clipPath>, or Canvas drawImage.
How does SVG clipPathUnits="objectBoundingBox" work for text scaling?
When clipPathUnits is set to objectBoundingBox, all SVG coordinates inside <clipPath> are evaluated on a 0.0 to 1.0 fractional coordinate scale relative to the target element. This ensures the text mask scales responsively with video width and height.
What fonts work best for video knockout typography?
Ultra-bold, heavy sans-serif fonts with wide glyph stems (such as Impact, Montserrat 900, Anton, or Arial Black) provide the largest visual surface area for footage motion to register clearly.
Is video text masking accessible to screen readers?
Yes. With the mix-blend-mode technique, your text resides inside standard semantic HTML elements (<h1>, <h2>) and is 100% selectable, copyable, and readable by assistive technologies and search engine crawlers.