<section class="section-video fixed">
<div class="section-video-inner"></div>
<video class="video" src="sample.mp4" autoplay loop muted></video>
</section>
<section class="section">
<h1>content 1</h1>
</section>
<section class="section skyblue">
<h1>content 2</h1>
</section>
<section class="section">
<h1>content 3</h1>
</section>
<section class="section lightgreen">
<h1>content 4</h1>
</section>
body {
margin: 0;
padding: 0;
}
.section {
display: grid;
place-items: center;
position: relative;
z-index: 2;
width: 100%;
aspect-ratio: 16 / 9;
}
.skyblue {
background: skyblue;
}
.lightgreen {
background: lightgreen;
}
.section-video-inner {
display: grid;
place-items: center;
position: absolute;
z-index: 2;
width: 100%;
height: 100%;
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='2' height='2' fill='black' opacity='0.5'/%3E%3Crect x='2' width='2' height='2' fill='none'/%3E%3C/svg%3E");
background-size: 4px 4px;
}
.video {
width: 100%;
height: 100%;
object-fit: cover;
filter: brightness(0.5);
}
.fixed {
position: fixed;
inset: 0;
z-index: 1;
width: 100%;
height: 100%;
}
元記事を表示する