1 回答
TA贡献1856条经验 获得超11个赞
我会将元素放置在中心周围,然后使用平移来偏移它们。我还将考虑使用遮罩而不是剪辑路径,以轻松使其位于中心。
viewBox更改 SVG 时,您可能需要调整font-family
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: 8vw;
font-weight: 600;
text-transform: uppercase;
}
.description-wrapper {
position: absolute;
top: 50%;
transform:translateY(120%);
left: 1.4%;
}
.description {
margin: 0;
font-size: 4vw;
font-weight: 400;
}
.video-wrapper {
height: 100%;
-webkit-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -10 70 12"><text font-family="monospace">MASK</text></svg>') center/contain no-repeat;
mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -10 70 12"><text font-family="monospace">MASK</text></svg>') center/contain no-repeat;
}
.video {
width: 100%;
height: 100%;
object-fit: cover;
display:block;
}
.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>
</div>
</div>
</section>
- 1 回答
- 0 关注
- 101 浏览
添加回答
举报