How to implement curve background in CSS? [duplicate]

Solution 1:

I will consider the same idea as this previous answer to create the curve using mask and radial-gradient. Simply adjust both variables until you get the needed result:

.box {
  height:300px;
  background: url(https://images.unsplash.com/photo-1581362508717-f542c1ecf295?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1651&q=80) center/cover;
  -webkit-mask:
    radial-gradient(var(--r1,100%) var(--r2,50%) at top   ,white 79.5%,transparent 80%) top left,
    radial-gradient(var(--r1,100%) var(--r2,50%) at bottom,transparent 79.5%,white 80%) top center,
    radial-gradient(var(--r1,100%) var(--r2,50%) at top   ,white 79.5%,transparent 80%) top right;
  mask:
    radial-gradient(var(--r1,100%) var(--r2,50%) at top   ,white 79.5%,transparent 80%) top left,
    radial-gradient(var(--r1,100%) var(--r2,50%) at bottom,transparent 79.5%,white 80%) top center,
    radial-gradient(var(--r1,100%) var(--r2,50%) at top   ,white 79.5%,transparent 80%) top right;
   /* adjust the 150% to control the covered area, the bigger the value the bigger the area will be*/
  -webkit-mask-size:33.4% 150%;
  -webkit-mask-repeat:no-repeat;
  mask-size:33.4% 150%;
  mask-repeat:no-repeat;
}
<div class="box" style="--r1:130%;--r2:71.5%">

</div>

To understand the trick replace the mask with background:

.box {
  height:300px;
  background:
    radial-gradient(var(--r1,100%) var(--r2,50%) at top   ,red 79.5%,transparent 80%)  top left,
    radial-gradient(var(--r1,100%) var(--r2,50%) at bottom,transparent 79.5%,blue 80%) top center,
    radial-gradient(var(--r1,100%) var(--r2,50%) at top   ,red 79.5%,transparent 80%)  top right;
  mask:
    radial-gradient(var(--r1,100%) var(--r2,50%) at top   ,red 79.5%,transparent 80%)  top left,
    radial-gradient(var(--r1,100%) var(--r2,50%) at bottom,transparent 79.5%,blue 80%) top center,
    radial-gradient(var(--r1,100%) var(--r2,50%) at top   ,red 79.5%,transparent 80%)  top right;
  background-size:33.4% 150%;
  background-repeat:no-repeat;
  border:1px solid;
}
<div class="box" style="--r1:130%;--r2:71.5%">

</div>

Applying this to your code:

.hero-container {
  background: url(https://images.unsplash.com/photo-1581362508717-f542c1ecf295?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1651&q=80) top/cover;
  padding: 16.625rem 0;
  -webkit-mask:
    radial-gradient(var(--r1,160%) var(--r2,68.15%) at top   ,white 79.5%,transparent 80%) top left,
    radial-gradient(var(--r1,160%) var(--r2,68.15%) at bottom,transparent 79.5%,white 80%) top center,
    radial-gradient(var(--r1,160%) var(--r2,68.15%) at top   ,white 79.5%,transparent 80%) top right;
  mask:
    radial-gradient(var(--r1,160%) var(--r2,68.15%) at top   ,white 79.5%,transparent 80%) top left,
    radial-gradient(var(--r1,160%) var(--r2,68.15%) at bottom,transparent 79.5%,white 80%) top center,
    radial-gradient(var(--r1,160%) var(--r2,68.15%) at top   ,white 79.5%,transparent 80%) top right;
  -webkit-mask-size:33.4% 140%; 
  -webkit-mask-repeat:no-repeat;
  mask-size:33.4% 140%;
  mask-repeat:no-repeat;
}
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css">
<section class="hero-container position-relative">
  <div class="container">
    <div class="row">
      <div class="col-md-7 col-xs-12">
        <h1 class="mb-3">Lorem ipsum dolor sit amet</h1>
        <p class="mb-4 text-white">Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet Lorem ipsum dolor sit amet</p>
        <button class="btn btn-secondary">Register My Club</button>
      </div>
    </div>
  </div>
</section>