<!-- 
   
Forum question answer only :

https://www.sitepoint.com/community/t/slanted-divs-with-background-image/382589/2

--!>


<section class="bg-theme-dark slanted-top slanted-bottom">
  <div class="container  ">

    <div class="row ">
      <div class="col-md-8 offset-md-2 my-auto py-5" >
        <h2 class="white">Lorem ipsum dolor sit amet</h2>
        <p class="white">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      </div>

    </div><!-- close row -->
  </div><!-- close container -->
</section> 


<section class="bg-theme-dark slanted-top-r slanted-bottom-r">
  <div class="container  ">

    <div class="row ">
      <div class="col-md-8 offset-md-2 my-auto py-5" >
        <h2 class="white">Lorem ipsum dolor sit amet</h2>
        <p class="white">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
      </div>

    </div><!-- close row -->
  </div><!-- close container -->
</section> 
/*

Forum question answer only :

https://www.sitepoint.com/community/t/slanted-divs-with-background-image/382589/2

*/


/* ==========================================  */
/* =====        Slanted Divs          ========  */
/* ==========================================  */

.bg-theme-dark {
  margin: 2rem 0;
  padding: 8rem 0px;
  background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.6) 0%,
      rgba(0, 0, 0, 0.6) 86%,
      rgba(0, 0, 0, 0.6) 100%
    ),
    url("https://dev.signal-web.com/assets/img/home-hero.jpg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  clip-path: polygon(0 14%, 100% 0, 100% 100%, 0 86%);
}
.bg-theme-dark:nth-child(even) {
  clip-path: polygon(0 0, 100% 14%, 100% 86%, 0 100%);
}

/* general styles */
.white {
  color: #fff;
}
Run Pen

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.0.2/css/bootstrap.min.css
  2. https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.1/js/bootstrap.min.js