Как создать эффект свернутой ленты с помощью CSS?

Я пытаюсь преобразовать информационную графику на основе изображений в html и css.
Я могу получить там 90%, но мне нужна помощь с эффектом свернутой ленты. Инфографика имеет такие варианты Да / Нет:

Конец "ленты" загибаем и высовываем низ более темного оттенка основного цвета.

введите сюда описание изображения

Вот что у меня есть на данный момент:

    .container { display: flex; flex-wrap: wrap; background-color: white; border-radius: 1em; }
    .container .header { width: 100%; font-size: 3em; font-weight: bold; line-height: 0.9; padding: 1em 3em !important; text-align: center }
    .container .child:first-child { width: 100%; }
    .container .child:not(:first-child) { width: 50%; font-size: 13px; }
    .container .child { display: inline-block; padding: 1em; }
    .container .leftcol { border-right: 2px solid black; }
    .container .redright { position: relative; background-color: #cd1719; color: white; font-size: 3em; font-weight: bold; padding-left: 0.5em; border-radius: 0.25em; margin-bottom: 0.5em; }
    .container .greenleft { position: relative; background-color: #7fbc03; color: white; text-align: right; font-size: 3em; font-weight: bold; padding-right: 0.5em; border-radius: 0.25em; margin-bottom: 0.5em; }
    .container .greenleft::before { content: ""; position: absolute; top: 0; left: 0; border-width: 1.5em 1em 1.25em 0; border-color: white #7fbc03 transparent transparent; display: block; border-style: solid; bottom: -1em; }

 
 
   <div class="container">
        <div class="child header">Header</div>
        <div class="child leftcol">
            <div class="greenleft">Yes</div>
            <p>Content on the left</p>
        </div> 
           <div class="child rightcol">
            <div class="redright">No</div>
            <p>Content on the right</p>
        </div>
    </div>    

Свободный перевод вопроса How can I do a folded ribbon effect using CSS? от участника @RodCoate.


Ответы (1 шт):

Автор решения: Alexandr_TT

Я бы сделал это так:

.box {
  width: 200px;
  padding: 10px 20px;
  margin: 40px 80px;
  color: #fff;
  text-align: right;
  background: #7fbc03;
  border-radius: 8px;
  position: relative;
  z-index: 0;
}

.box::before,
.box::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  background: inherit;
  border-radius:inherit;
  border-bottom-left-radius:0;
  transform-origin: top left;
}

.box::before {
  left: 0;
  right: 20%;
  transform: skewX(-40deg);
}

.box::after {
  z-index: -2;
  left: 1px;
  height: 130%; /* ~ 100%/cos(40deg) */
  width: 40px;
  filter: brightness(0.7);
  transform: rotate(40deg);
}

.right {
  text-align: left;
  background: #cd1719;
}

.right::before {
  right: 0;
  left: 20%;
  border-bottom-right-radius:0;
  border-bottom-left-radius:inherit;
  transform: skewX(40deg);
}

.right::after {
  right: 1px;
  left: auto;
  transform-origin: top right;
  border-bottom-right-radius:0;
  border-bottom-left-radius:inherit;
  transform: rotate(-40deg);
}
<div class="box">YES</div>

<div class="box right">NO</div>

<div class="box right" style="background:lightblue;">Two <br> lines</div>

<div class="box" style="background:purple;width:auto;">full width</div>

<div class="box right" style="background:orange;width:auto;display:inline-block">auto width</div>

введите сюда описание изображения

Свободный перевод ответа от участника Temani Afif.

→ Ссылка