<div class="cp_card">
コンテンツ
<div class="cp_ribbon08">
<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 {
position: absolute;
top: 20px;
left: -8px;
}
/*リボン内のテキスト*/
.cp_ribbon08 .cp_ribbon {
position: relative;
display: flex;
align-items: center;
width: 100%;
height: 40px;
padding: 0 0 0 10px;
color: #ffffff;
background: #4CAF50;
}
/*擬似要素の共通設定*/
.cp_ribbon08:before,
.cp_ribbon08:after {
position: absolute;
content: '';
}
.cp_ribbon08:before {/*リボンの影部分*/
top: -8.5px;
left: 0.1px;
border-bottom: 9px solid #2E7D32;
border-left: 9px solid transparent;
}
/**/
.cp_ribbon08:after {/*リボン下のカット部分*/
top: 0;
right: -20px;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 10px solid #4CAF50;
}