<!-- Hero Section -->
<section class="hero" id="hero">
  <!-- Gradient Background -->
  <div class="hero-grad"></div>
  <!-- /Gradient Background -->
  
  <!-- The SVG Diagonal Polygon (The important stuff) -->
  <svg class="hero-diagonal" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none">
    <polygon points="0,100 100,0 100,100"></polygon>
  </svg>
  <!-- /The SVG Diagonal Polygon -->
  
  <!-- Demo Heading -->
  <main class="hero-content">
    <h1 class="heading">
      Take a "scroll" and watch the magic happen.
    </h1>
    <div class='hero-scroll'><div/>
  </main>
  <!-- /Demo Heading -->
</section>
<!-- /Hero Section -->

<!-- Demo Content -->
<article class="content">
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Consequat interdum varius sit amet. Pharetra massa massa ultricies mi quis hendrerit dolor magna eget. Sagittis aliquam malesuada bibendum arcu. Lorem ipsum dolor sit amet consectetur. Suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Adipiscing bibendum est ultricies integer quis auctor. Scelerisque felis imperdiet proin fermentum leo vel. Morbi tincidunt augue interdum velit euismod in. Odio pellentesque diam volutpat commodo sed. Leo integer malesuada nunc vel risus. Ultricies lacus sed turpis tincidunt id aliquet risus feugiat. Amet nisl purus in mollis nunc sed. Aliquam nulla facilisi cras fermentum. Condimentum id venenatis a condimentum vitae sapien pellentesque habitant morbi. Feugiat in fermentum posuere urna nec.</p>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Consequat interdum varius sit amet. Pharetra massa massa ultricies mi quis hendrerit dolor magna eget. Sagittis aliquam malesuada bibendum arcu. Lorem ipsum dolor sit amet consectetur. Suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Adipiscing bibendum est ultricies integer quis auctor. Scelerisque felis imperdiet proin fermentum leo vel. Morbi tincidunt augue interdum velit euismod in. Odio pellentesque diam volutpat commodo sed. Leo integer malesuada nunc vel risus. Ultricies lacus sed turpis tincidunt id aliquet risus feugiat. Amet nisl purus in mollis nunc sed. Aliquam nulla facilisi cras fermentum. Condimentum id venenatis a condimentum vitae sapien pellentesque habitant morbi. Feugiat in fermentum posuere urna nec.</p>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Consequat interdum varius sit amet. Pharetra massa massa ultricies mi quis hendrerit dolor magna eget. Sagittis aliquam malesuada bibendum arcu. Lorem ipsum dolor sit amet consectetur. Suspendisse ultrices gravida dictum fusce ut placerat orci nulla. Adipiscing bibendum est ultricies integer quis auctor. Scelerisque felis imperdiet proin fermentum leo vel. Morbi tincidunt augue interdum velit euismod in. Odio pellentesque diam volutpat commodo sed. Leo integer malesuada nunc vel risus. Ultricies lacus sed turpis tincidunt id aliquet risus feugiat. Amet nisl purus in mollis nunc sed. Aliquam nulla facilisi cras fermentum. Condimentum id venenatis a condimentum vitae sapien pellentesque habitant morbi. Feugiat in fermentum posuere urna nec.</p>
</article>
<!-- /Demo Content -->
// Change me
$bg: #1d1f20;

body{
  background-color: $bg;
}
.hero {
  position: relative;
  background-image: url(https://picsum.photos/id/103/1900/900);
  background-size: cover;
  background-position: bottom center;
  border: 2vw solid $bg;
  
  &-grad {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(90deg, rgba(#FDBB2D, 0.8) 0%, rgba(#3A1C71, 0.67) 100%);
    z-index: 0;
  }
  &-diagonal{
    position: absolute;
    bottom: -0.5px;
    width: 100%;
    // Change the height if you want the skew to be more "aggressive"
    height: 12vw;
    z-index: 2;
    fill: $bg;
    // Uncomment opacity prop to see how it works
    // opacity: 0.85;
  }
  &-content{
    position: relative;
    padding: 60px;
    padding-top: 10vw;
    padding-bottom: 10vw;
    z-index: 1;
    text-align: center;
    
    .heading{
      font-size: 40px;
      max-width: 700px;
      font-weight: 100;
      margin: 0 auto;
      color: $bg;
      line-height: 1.5;
      letter-spacing: 8px;
      text-transform: uppercase;
      margin-bottom: 60px;
    }
  }
  &-scroll {
    width: 40px;
    height: 70px;
    box-shadow: inset 0 0 0 1px $bg;
    border-radius: 25px;
    position: relative;
    display: inline-block;
    
    &:before {
      content: '';
      width: 8px;
      height: 8px;
      position: absolute;
      left: 50%;
      background: $bg;
      margin-left: -4px;
      top: 8px;
      border-radius: 4px;
      animation-duration: 1.5s;
      animation-iteration-count: infinite;
      animation-name: scroll;
    }
  }
}

.content{
  width: 90%;
  max-width: 700px;
  font-size: 20px;
  color: #fff;
  margin: 0 auto;
  padding: 60px 0;
  line-height: 1.6;
  
  p{
    margin-top: 0;
    margin-bottom: 60px;
    color: mix(#FDBB2D, #3A1C71, 40%);
  }
}

@keyframes scroll {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(46px);
  }
}
View Compiled
var handleScroll = function() {
  // Get the height of the hero section
  var heroHeight = document.querySelector('#hero').offsetHeight;
  var diagonal = document.querySelector('.hero-diagonal polygon');
  // Calculate the skew value
  var skew = (window.scrollY / heroHeight) * 100;
  // Assign the skew value to the polygon points attr
  // The value needs to be set as an array
  diagonal.setAttribute('points', [0,100, 100, skew, 100,100]);
}
window.addEventListener("scroll", handleScroll);
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.