Skip to content Skip to sidebar Skip to footer

How Can I Set A Max-values To A Css Mask?

i am using this code to implemente a svg mask in top of a video layer. It works great, but how can i set a max value to the css-mask, so i can control the maxium size of it? My Cod

Solution 1:

I see you are using min(). You can do the same with the mask-size:

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";
  margin: 0;
  padding: 0;
}

.container {
  position: relative;
  height: 100vh;
  background: #000;
  color: #fff;
}

.headline-wrapper {
  position: absolute;
  top: 50%;
  transform:translateY(-180%);
  left: 1.4%;
}

.headline {
  margin: 0;
  font-size: min(8vw, 82px);
  font-weight: 600;
  text-transform: uppercase;
}

.description-wrapper {
  position: absolute;
  top: 50%;
  transform:translateY(120%);
  left: 1.4%;
}

.description {
  margin: 0;
  font-size: min(5vw, 57px);
  font-weight: 400;
}

.video-wrapper {
  height: 100%;
   -webkit-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -10 70 12"><text font-family="monospace">MASK</text></svg>') center left/min(100%,1000px) auto no-repeat;
           mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-2 -10 70 12"><text font-family="system-ui">MASK</text></svg>') center left/200px auto no-repeat;

}

.video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
}
<section><divclass="container"><divclass="headline-wrapper"><h3class="headline">Headline</h3></div><divclass="description-wrapper"><pclass="description">Description</p></div><divclass="video-wrapper"><videoclass="video"src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"type="video/mp4"mutedloopautoplay="true"></video></div></div></section>

Post a Comment for "How Can I Set A Max-values To A Css Mask?"