Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <!-- 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 -->
              
            
!

CSS

              
                // 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);
  }
}

              
            
!

JS

              
                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);
              
            
!
999px

Console