<h2 class="ribbon">Title Ribbon</h2>
<h3 class="ribbon" style="--s:50px;--d:10px;--c:15px;background-color: #45ADA8">Another Ribbon</h3>
<h4 class="ribbon" style="--s:25px;--d:8px;--c:10px;background-color: #B9D7D9">A little one</h4>
.ribbon {
  --s: 70px; /* the ribbon size */
  --d: 20px; /* the depth */
  --c: 20px; /* the cutout part */
  /* update one variable a time and you will understand what it does */
  
  padding: 0 calc(var(--s) + var(--d)) var(--d);
  background:
    conic-gradient(at left  var(--s) bottom var(--d),
     #0000 25%,#0008 0 37.5%,#0004 0) 0   /50% no-repeat,
    conic-gradient(at right var(--s) bottom var(--d),
     #0004 62.5%,#0008 0 75%,#0000 0) 100%/50% no-repeat;
  clip-path: polygon(0 var(--d), var(--s) var(--d),var(--s) 0,calc(100% - var(--s)) 0,calc(100% - var(--s)) var(--d),100% var(--d),calc(100% - var(--c)) calc(50% + var(--d)/2),100% 100%,calc(100% - var(--s) - var(--d)) 100%,calc(100% - var(--s) - var(--d)) calc(100% - var(--d)),calc(var(--s) + var(--d)) calc(100% - var(--d)),calc(var(--s) + var(--d)) 100%,0 100%,var(--c) calc(50% + var(--d)/2));
  background-color: #CC333F; /* the main color */
  /* width: fit-content; you may need to use this in your code if the element is full width */
}



body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-content: center;
  place-items: center;
}

h2,
h3,
h4{
  font-family: sans-serif;
  color: #fff;
  line-height: 1.8;
  font-size: 2em;
  text-align: center;
}
h3 {
  font-size: 1.5em;
}
h4 {
  font-size: 1em;
  color: #000;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.