Masked fixed text (using clip-path and position fixed)

by Konstantin Rouda

HTML

<header class="c-header">
  <h1 class="c-header__title">Just Do It</h1>
</header>
<main class="c-main">
  some text in main
</main>

CSS

HTML {
  /*using system font-stack*/
   font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: calc(16px + (20 - 16) * (100vw - 300px) / (1100 - 300) );
  line-height: 1.5;
  box-sizing: border-box;
}

BODY {
  height: 720px;
  margin: 0;
  padding-bottom: 2rem;
  color: rgb(58, 61, 64);
  background-color: rgb(254, 254, 254);
}

*, *::before, *::after {
  box-sizing: inherit;
  color: inherit;
}


/*Actual Style*/
.c-header {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 200vh;
  clip-path: polygon(0% 0%, 100% 0%, 100% 200vh, 0% 200vh);
  background: cornflowerblue;
}

.c-header__title {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  font-size: 4rem;
  background: firebrick;
  box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, .11);
}


.c-main {
  height: 200vh;
}