<div class="cp_card">
コンテンツ
<div class="cp_ribbon11">
<div class="cp_ribbon">Ribbon</div>
</div>
</div>
.cp_card {
position: relative;/*リボンをかけたいコンテンツボックスにセット*/
width: 300px;
height: 300px;
background: #ffffff;
margin: auto;
padding: 60px 5px 0;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
/*リボンの設定*/
.cp_ribbon11 {
line-height: 50px;
position: absolute;
top: 15px;
display: flex;
justify-content: center;
align-items: center;
width: calc(100% + 10px);
height: 40px;
margin-right: -10px;
margin-left: -10px;
text-align: center;
color: #ffffff;
background: #2196F3;
}
/*リボンの影の共通設定*/
.cp_ribbon11:before,
.cp_ribbon11:after {
position: absolute;
top: 100%;
content: '';
border-top: 5px solid #1565C0;
border-left: 5px solid transparent;
}
.cp_ribbon11:before {
left: 0;
}
.cp_ribbon11:after {
right: 0;
transform: scale(-1, 1);/*左右反転*/
}