i am using the following code to mask a background video in a svg text with some other text around. My problem is that the white texts do not keep their position on resizing, although I work with vh and vw units. And the white heading and the white description do not have the same distance to the MASK.
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
.font-serif font-family: Georgia, Cambria, "Times New Roman", Times, serif;
.font-mono font-family: Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
margin: 0;
padding: 0;
}
.container {
position: relative;
height: 100vh;
width: 100%;
background: #000;
}
.headline-wrapper {
position: absolute;
top: 2vh;
left: 1.4%;
}
.headline {
margin: 0;
font-size: 8vw;
font-weight: 600;
color: #fff;
text-transform: uppercase;
}
.description-wrapper {
position: absolute;
top: 70vh;
left: 1.4%;
}
.description {
margin: 0;
font-size: 4vw;
font-weight: 400;
color: #fff;
}
.video-wrapper {
position: relative;
overflow: hidden;
clip-path: url(#mask);
}
.video {
width: 100%;
height: 100vh;
object-fit: cover;
}
.mask-text {
text-anchor: start;
font-size: 16vw;
font-weight: bold;
}
<section>
<div class="container">
<div class="headline-wrapper">
<h3 class="headline">Headline</h3>
</div>
<div class="description-wrapper">
<p class="description">Description</p>
</div>
<div class="video-wrapper">
<video class="video" src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4" muted loop autoplay="true"></video>
<svg><clipPath id="mask"><text class="mask-text" x="2%" y="55vh">MASK</text></clipPath></svg>
</div>
</div>
</section>
my goal is to keep the white texts in its position, always at the same distance from the MASK text, so that it is responsive. How can this be achieved? Is there an only-css solution for this?