<div class="cp_card">
コンテンツ
<div class="cp_ribbon08_2">
<div class="cp_ribbon">Ribbon</div>
</div>
</div>
.cp_card {
position: relative;/*リボンをかけたいコンテンツボックスにセット*/
width: 300px;
height: 300px;
background: #ffffff;
margin: auto;
padding: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
/*リボンの位置*/
.cp_ribbon08_2 {
position: absolute;
top: 20px;
left: -8px;
}
/*リボン内のテキスト*/
.cp_ribbon08_2 .cp_ribbon {
position: relative;
display: flex;
align-items: center;
width: 100%;
height: 40px;
padding: 0 5px 0 10px;
color: #ffffff;
background: #4CAF50;
clip-path: polygon(0% 0%, 85% 0%, 100% 50%, 85% 100%, 0% 100%);
}
.cp_ribbon08_2:before {/*リボンの影部分*/
position: absolute;
content: '';
top: -8px;
left: 0;
width: 8px;
height: 8px;
background-color: #2E7D32;
clip-path: polygon(100% 0, 0% 100%, 100% 100%);
}