<div class="hero--diagonal">
  <div class="hero__content">
    <h1>Diagonal Containers in CSS</h1>
  </div>
</div>
body {
  padding: 5.25rem 0;
}
.hero--diagonal {
  position: relative;
  background-color: transparent;
  min-height: 50vh;
  padding: 1vh 0;
  display: flex;
  align-items: center;
  justify-content: center;

  &::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 0;
    width: 100%;
    height: calc(100% + 100px);
    clip-path: polygon(0% 0%, 100% 50px, 100% 100%, 0% calc(100% - 50px));
    background-color: #eee;
  }

  .hero__content {
    position: relative;
    z-index: 1;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.